kubectl 치트시트
Kubernetes 1.30+에서 Pod, Deployment, Service 검사, 로그 확인, exec 디버깅, 롤아웃, 컨텍스트 전환 및 JSONPath 쿼리를 위한 Kubernetes CLI 명령어.
동작 원리
kubectl reads and reconciles declarative resource manifests against the API server: `get`/`describe`/`logs` diagnose state, while `apply`/`rollout` safely drive cluster changes.
서바이벌 키트
가장 먼저 배워야 할 몇 가지 명령어입니다.
42개 명령어
Contexts, Namespaces & Discovery
Verify which cluster and namespace you target before reading or changing state.
- 기본
Print the currently active cluster context before running commands
kubectl config current-context사용 시점
Prevents accidentally running dev commands against a production cluster.
예제
kubectl config current-context
Inspect, Logs & Events
Diagnose CrashLoopBackOff, ImagePullBackOff, pending pods, and probe failures.
Shell, Port-Forward & Copy
Connect to cluster services locally, exec into pods, and transfer files.
Apply, Dry-Run & Rollouts
Validate manifests safely, watch rollouts, scale, and roll back cleanly.
Nodes, RBAC & Cleanup
Verify permissions, check resource usage, cordon nodes, and clean pods.