Skip to content
Latchkey

kubectl Cheat Sheet: Commands for Everyday Kubernetes

The kubectl commands you run every day, plus the debugging ones you need under pressure.

Inspect, apply, roll out, and debug - the kubectl essentials.

Inspect

CommandDoes
kubectl get pods -AAll pods, all namespaces
kubectl describe pod NAMEPod details + events
kubectl logs -f NAMEFollow logs
kubectl get events --sort-by=.lastTimestampRecent events
kubectl top podsCPU/memory usage

Apply & rollout

CommandDoes
kubectl apply -f file.yamlApply manifest
kubectl rollout status deploy/NAMEWait for rollout
kubectl rollout undo deploy/NAMERoll back
kubectl scale deploy/NAME --replicas=3Scale

Debug

CommandDoes
kubectl exec -it NAME -- shShell into a pod
kubectl describe node NAMENode pressure/taints
kubectl get pod NAME -o yamlFull pod spec
kubectl config current-contextActive cluster

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →