Bảng tra cứu nhanh kubectl
Lệnh Kubernetes CLI để kiểm tra pod, deployment, service, xem log, exec gỡ lỗi, rollout, context và truy vấn JSONPath trên Kubernetes 1.30+.
Cách hoạt động
kubectl reads and reconciles declarative resource manifests against the API server: `get`/`describe`/`logs` diagnose state, while `apply`/`rollout` safely drive cluster changes.
Bộ lệnh sống còn
Vài lệnh nên học trước tiên.
42 lệnh
Contexts, Namespaces & Discovery
Verify which cluster and namespace you target before reading or changing state.
- Cơ bản
Print the currently active cluster context before running commands
kubectl config current-contextKhi nào dùng
Prevents accidentally running dev commands against a production cluster.
Ví dụ
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.