Skip to content

Kubernetes Production Cheat Sheet

A battle-tested reference guide of the most frequently used kubectl commands for production cluster administration and troubleshooting.


Terminal window
# View cluster endpoint and core service info
kubectl cluster-info
# View kubeconfig contexts and active cluster
kubectl config get-contexts
kubectl config current-context
# Switch to a different cluster context
kubectl config use-context prod-cluster
# Set default namespace for current context
kubectl config set-context --current --namespace=production

Terminal window
# List all pods with IP addresses and host node assignments
kubectl get pods -o wide
# Show detailed lifecycle events, probe states, and failure reasons
kubectl describe pod <pod-name>
# Stream live stdout/stderr logs from a pod
kubectl logs -f <pod-name>
# View logs from a previous, crashed container instance (CrashLoopBackOff)
kubectl logs -p <pod-name>
# Interactive shell execution
kubectl exec -it <pod-name> -- /bin/sh