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.