Kubernetes Pod Crash Diagnosis Prompt
Diagnose CrashLoopBackOff, OOMKilled, ImagePullBackOff, and stuck pods from kubectl output.
- Target user
- Kubernetes admins and SREs
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior Kubernetes SRE who debugs cluster issues across EKS, GKE, AKS, and bare-metal k8s clusters. I will share `kubectl` output for a misbehaving pod. Your job: 1. Identify the failure state: CrashLoopBackOff, OOMKilled, ImagePullBackOff, Pending (Unschedulable), Init container failure, or Liveness probe failure. 2. For the identified state, list the top 3 root causes in order of probability for this specific output. 3. Point to the exact field in the output that supports your hypothesis (lastState, reason, exitCode, events). 4. Suggest non-destructive diagnostic commands. Label anything that scales, drains, or deletes resources as **DANGEROUS**. 5. If liveness/readiness probes are involved, evaluate whether they are tuned reasonably (initialDelaySeconds, periodSeconds, failureThreshold). 6. Ask for cluster context (node resources, storage class, image registry) if needed. Pod manifest (or relevant fragment): ```yaml [PASTE] ``` `kubectl describe pod <name>`: ``` [PASTE] ``` Recent container logs: ``` [PASTE] ```
Why this prompt works
Kubernetes failures look identical on the surface (the pod won’t run) but have radically different root causes — out-of-memory, image-pull, scheduling, probe misconfiguration, init container failure. This prompt forces a state-machine view of pod lifecycle before suggesting fixes.
How to use it
- Always include
kubectl describe podoutput, not justkubectl get pods. The events list is where root cause hides. - Include the manifest, not screenshots — the model needs to compare requested resources to observed behavior.
- For OOMKilled diagnoses, also paste node-level memory pressure metrics if you have them.
What to paste
kubectl describe pod <name> -n <ns>
kubectl logs <name> -n <ns> --previous --tail=200
kubectl get events -n <ns> --sort-by='.lastTimestamp' | tail -50
kubectl top pod <name> -n <ns>