Describe node conditions k8s-debug
Check node conditions: Ready, MemoryPressure, DiskPressure
kubectl describe node my-node | grep -A5 'Conditions:'
more k8s-debug
all 27 commands →
Find pods by resource usage
kubectl top pods -A --sort-by=memory | head -20
Watch pod events
kubectl get events -n mynamespace --field-selector involvedObject.name=mypod --watch
Copy file from pod
kubectl cp mynamespace/mypod:/var/log/app.log ./app.log
Top pods by restart count
kubectl get po -A --sort-by='.status.containerStatuses[0].restartCount' | tail -20
Detect OOMKilled containers
kubectl get po -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{" "}{.status.containerStatuses[*].lastState.terminated.reason}{"\n"}{end}' | grep OOMKilled