# kubectl Command

## kubectl 주요 명령&#x20;

### 주요 자원 상태 확인&#x20;

```
# 주요 자원 확인 
kubectl get all
kubectl get all --all-namespaces
kubectl get namespace
kubectl get nodes
kubectl get pods
kubectl get svc
kubectl get ingress
kubectl get daemosets
kubectl get namespace,nodes,pods,svc,ingress

#Detials
kubectl get nodes -o wide
kubectl get pods -o wide
kubectl get svc -o wide
kubectl get ingress -o wide
kubectl get daemosets -o wide

#특정 namespaces
kubectl -n "namespace-name" get nodes,pods,svc,ingress

# 상세 내용 확인 
kubectl get all --all-namespace -o wide
```

### 생성 및 배포&#x20;

```
kubectl apply -f "manifest file path"
kubectl -n "namespaces" apply -f "manifest file path"
kubectl scale deployment "pod_name" --replicas=3
kubectl -n "namespaces" scale deployment "pod_name" --replicas=3

```

### ELB 주소 확인

```
kubectl get svc -n "namespace name" "pod name" --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"
```

### 배포 상태 확인

```
kubectl describe deployment "app"
kubectl get deployment "app"
kubectl get deployment "app" -o wide
kubectl -n "namespace-name" get deployment "app"
kubectl -n "namespace-name" describe deployment "app"
```

### 삭제

```
kubectl delete -f "manifest file path"
kubectl -n "namespaces" delete -f "manifest file path"
```

### log확인

```
kubectl logs -n "namespace" "pods name"
```

### 인증&#x20;

```
kubectl -n kube-system edit configmaps aws-auth
kubectl edit clusterrole cluster-admin
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whchoi98.gitbook.io/k8s/tip/kubectl-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
