Copy file from pod
Download a file from a running container
kubectl cp mynamespace/mypod:/var/log/app.log ./app.log
- tool
- k8s-debug27 commands
More k8s-debug commands
-
kubectl get po -A --sort-by='.status.containerStatuses[0].restartCount' | tail -20Rank pods cluster-wide by restart count to spot crash loops fast
-
kubectl get po -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{" "}{.status.containerStatuses[*].lastState.terminated.reason}{"\n"}{end}' | grep OOMKilledList pods whose last container exit was OOMKilled across all namespaces
-
kubectl get po -A --field-selector=status.phase=Pending -o name | xargs -I{} kubectl describe {} -n <ns> | grep -A3 FailedSchedulingExtract FailedScheduling reasons for every Pending pod (taints, resources, affinity)
-
kubectl describe node <node> | grep -A12 Conditions; ssh <node> 'journalctl -u kubelet -n 100 --no-pager'Read node Conditions then tail kubelet journal to find why node is NotReady
-
kubectl get events -n <ns> --field-selector reason=Failed -o wide | grep -i 'pull\|manifest\|unauthorized'Surface registry pull failures: bad tag, missing imagePullSecret, or rate limit