Kubernetes Production Cheat Sheet
A battle-tested reference guide of the most frequently used kubectl commands for production cluster administration and troubleshooting.
1. Cluster Information & Contexts
Section titled “1. Cluster Information & Contexts”# View cluster endpoint and core service infokubectl cluster-info
# View kubeconfig contexts and active clusterkubectl config get-contextskubectl config current-context
# Switch to a different cluster contextkubectl config use-context prod-cluster
# Set default namespace for current contextkubectl config set-context --current --namespace=production2. Pod Lifecycle & Debugging
Section titled “2. Pod Lifecycle & Debugging”# List all pods with IP addresses and host node assignmentskubectl get pods -o wide
# Show detailed lifecycle events, probe states, and failure reasonskubectl describe pod <pod-name>
# Stream live stdout/stderr logs from a podkubectl logs -f <pod-name>
# View logs from a previous, crashed container instance (CrashLoopBackOff)kubectl logs -p <pod-name>
# Interactive shell executionkubectl exec -it <pod-name> -- /bin/sh