[CKA] kubectl 명령어 정리

CKA 실습에서 자주 쓰는 kubectl 조회·생성·삭제·로그 명령을 정리합니다.

# 조회
kubectl get pods
kubectl get services
kubectl get deployments
kubectl get nodes
kubectl describe pod <pod-name>
kubectl describe service <service-name>

# 생성과 적용
kubectl apply -f <filename.yaml>
kubectl create deployment <name> --image=<image>

# 삭제
kubectl delete pod <pod-name>
kubectl delete service <service-name>

# 로그와 컨테이너 명령 실행
kubectl logs <pod-name>
kubectl exec -it <pod-name> -- /bin/bash

# 스케일링
kubectl scale deployment <name> --replicas=3

# 네임스페이스
kubectl create namespace <name>
kubectl get namespaces

# 컨텍스트와 클러스터
kubectl config view
kubectl config use-context <context-name>
kubectl cluster-info