Top pods by restart count k8s-debug
Rank pods cluster-wide by restart count to spot crash loops fast
kubectl get po -A --sort-by='.status.containerStatuses[0].restartCount' | tail -20
more k8s-debug
all 27 commands →
Detect OOMKilled containers
kubectl get po -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{" "}{.status.containerStatuses[*].lastState.terminated.reason}{"\n"}{end}' | grep OOMKilled
Pending pods scheduling reason
kubectl get po -A --field-selector=status.phase=Pending -o name | xargs -I{} kubectl describe {} -n <ns> | grep -A3 FailedScheduling
Node NotReady triage
kubectl describe node <node> | grep -A12 Conditions; ssh <node> 'journalctl -u kubelet -n 100 --no-pager'
ImagePullBackOff root cause
kubectl get events -n <ns> --field-selector reason=Failed -o wide | grep -i 'pull\|manifest\|unauthorized'
Cleanup evicted pods
kubectl get po -A | grep Evicted | awk '{print $2" -n "$1}' | xargs -L1 kubectl delete po