Kubernetes Pod Debugging Cheat Sheet

Troubleshoot Pending, CrashLoopBackOff, image pull, readiness, liveness, and init container problems.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Pending and Unschedulable Pods

List Pending pods

Find pods stuck before startup.

bashANYpendingscheduling
bash
kubectl get pods -A --field-selector=status.phase=Pending

Describe a Pending pod

Look for FailedScheduling, taints, or PVC issues.

bashANYpendingdescribe
bash
kubectl describe pod <pod> -n <namespace>

List PersistentVolumeClaims

Check if pod scheduling is blocked on volume binding.

bashANYstoragepvc
bash
kubectl get pvc -A

Describe a PVC

Inspect storage class, events, and binding failures.

bashANYstoragepvc
bash
kubectl describe pvc <claim> -n <namespace>

Inspect node taints

Check whether tolerations are missing.

bashANYschedulingtaints
bash
kubectl describe node <node> | sed -n '/Taints:/,/Unschedulable:/p'

View pod node selectors and affinity

Inspect scheduling constraints from raw YAML.

bashANYschedulingaffinity
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.spec.nodeSelector}{"
"}{.spec.affinity}{"
"}'

CrashLoopBackOff and Image Pull Errors

Find CrashLoopBackOff pods

List pods that are restarting and failing to stay up.

bashANYcrashlooppods
bash
kubectl get pods -A | grep CrashLoopBackOff

Read logs from the previous failed container

Very useful when a restart wipes current state.

bashANYcrashlooplogs
bash
kubectl logs <pod> -n <namespace> -c <container> --previous

Describe image pull failures

Inspect ErrImagePull and ImagePullBackOff reasons.

bashANYimage-pullevents
bash
kubectl describe pod <pod> -n <namespace> | sed -n '/Events:/,$p'

Inspect image pull secrets referenced by a pod

Verify that imagePullSecrets are wired correctly.

bashANYimage-pullsecrets
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.spec.imagePullSecrets[*].name}{"
"}'

Describe docker registry secret

Check secret type and metadata for image pulls.

bashANYimage-pullsecrets
bash
kubectl describe secret <secret> -n <namespace>

Show waiting reason for first container

Compact way to inspect wait state reasons.

bashANYstatusreason
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.status.containerStatuses[0].state.waiting.reason}{"
"}'

Readiness, Liveness, and Startup Probes

Inspect configured probes

View readiness, liveness, and startup probe definitions.

bashANYprobeshealthchecks
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.spec.containers[*].readinessProbe}{"
"}{.spec.containers[*].livenessProbe}{"
"}{.spec.containers[*].startupProbe}{"
"}'

See probe failure events

Describe a pod and inspect event messages for failing probes.

bashANYprobesevents
bash
kubectl describe pod <pod> -n <namespace> | grep -A5 -i probe

Run the probe command manually

Validate probe behavior inside the container context.

bashANYprobesexec
bash
kubectl exec -it <pod> -n <namespace> -c <container> -- <probe-command>

Port-forward and test HTTP probe locally

Verify whether the probe endpoint behaves as expected.

bashANYprobeshttp
bash
kubectl port-forward pod/<pod> -n <namespace> 8080:<container-port>

Call a probe endpoint after port-forward

Use curl locally against the forwarded health endpoint.

bashANYprobescurl
bash
curl -i http://127.0.0.1:8080/healthz

Init Container Debugging

Inspect init container statuses

See waiting, terminated, and exit details for init containers.

bashANYinit-containersstatus
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.status.initContainerStatuses}{"
"}'

Read logs from an init container

Inspect the failing setup step before app containers start.

bashANYinit-containerslogs
bash
kubectl logs <pod> -n <namespace> -c <init-container>

Describe init container failure

Read events and termination details from the pod description.

bashANYinit-containersevents
bash
kubectl describe pod <pod> -n <namespace>

Copy a pod and override its command

Use kubectl debug to clone a pod with a safer command for inspection.

bashANYdebugcopy-pod
bash
kubectl debug <pod> -n <namespace> --copy-to=<pod>-copy --set-image='*=busybox:1.36' -it

Resources and OOMKilled

Check resource usage for a pod

Compare live usage against requests and limits.

bashANYresourcesmetrics
bash
kubectl top pod <pod> -n <namespace>

Show pod resource requests and limits

Inspect CPU and memory resource settings quickly.

bashANYresourceslimits
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.spec.containers[*].resources}{"
"}'

Show termination reason

Check whether the last exit reason was OOMKilled.

bashANYoomkilledstatus
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.status.containerStatuses[0].lastState.terminated.reason}{"
"}'

Show last exit code

Inspect the numeric exit code for the container.

bashANYexit-codestatus
bash
kubectl get pod <pod> -n <namespace> -o jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}{"
"}'

Recommended next

No recommendations yet.