Aide-mémoire kubectl
Commandes Kubernetes CLI pour inspecter pods, déploiements, services, journaux, débogage exec, déploiements progressifs, contextes et requêtes JSONPath sur Kubernetes 1.30+.
Comment ça fonctionne
kubectl reads and reconciles declarative resource manifests against the API server: `get`/`describe`/`logs` diagnose state, while `apply`/`rollout` safely drive cluster changes.
Kit de survie
Les quelques commandes à apprendre en premier.
42 commandes
Contexts, Namespaces & Discovery
Verify which cluster and namespace you target before reading or changing state.
- Essentiel
Print the currently active cluster context before running commands
kubectl config current-contextQuand l'utiliser
Prevents accidentally running dev commands against a production cluster.
Exemple
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.