Chuleta de kubectl
Comandos de Kubernetes CLI para inspeccionar pods, deployments, services, logs, depuración con exec, rollouts, contextos y consultas JSONPath en Kubernetes 1.30+.
Cómo funciona
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 supervivencia
Los comandos clave que conviene aprender primero.
42 comandos
Contexts, Namespaces & Discovery
Verify which cluster and namespace you target before reading or changing state.
- Esencial
Print the currently active cluster context before running commands
kubectl config current-contextCuándo usarlo
Prevents accidentally running dev commands against a production cluster.
Ejemplo
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.