Kubernetes Pod CrashLoopBackOff — How to Fix
A pod stuck in CrashLoopBackOff means your container starts and crashes repeatedly. This guide walks through every common cause and its fix.
What You'll Learn
How to diagnose and resolve Kubernetes pod crash loops using kubectl commands, log inspection, and configuration fixes.
Why It Matters
CrashLoopBackOff is the most common Kubernetes issue — fixing it fast keeps your services running and your team productive.
Real-World Use
A newly deployed microservice keeps restarting in staging. Your team can't test until the pod stays healthy.
Step 1 — Describe the Pod
kubectl describe pod <pod-name>
Expected output: Shows the container state, exit code, restart count, and recent events. Look for the Last State: Terminated block with exit code and reason.
Step 2 — Check Pod Logs
kubectl logs <pod-name>
For previous (crashed) container logs:
kubectl logs --previous <pod-name>
Expected output: Application error messages showing why the process exited.
Common Causes and Fixes
Application Crash on Startup
The most common cause — your app throws an error during initialization.
Fix: Check the logs for stack traces. Common issues:
- Missing environment variables
- Database connection failure
- Invalid configuration
Add readiness probes so Kubernetes knows when the app is truly ready:
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
Out of Memory (OOMKilled)
kubectl describe pod <pod-name> | grep -A5 "Last State"
If you see Reason: OOMKilled, increase the memory limit:
resources:
requests:
memory: "256Mi"
limits:
memory: "512Mi"
Liveness Probe Failure
If the liveness probe fails, Kubernetes restarts the pod. Check probe configuration:
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
Make sure initialDelaySeconds is long enough for your app to start.
ConfigMap or Secret Not Found
kubectl get configmap <name>
kubectl get secret <name>
Expected behavior: If the ConfigMap or Secret doesn't exist, the pod will fail to mount volumes or inject environment variables.
Image Pull Issues
kubectl describe pod <pod-name> | grep -i "image"
Check if the image tag exists and the registry is accessible.
Prevention Tips
- Set resource requests and limits on every container
- Use startup probes for slow-starting applications
- Add preStop hooks for graceful shutdown
- Test configuration changes in a dev namespace first
Quick Reference
| Symptom | Command | Fix |
|---|---|---|
| OOMKilled | kubectl describe pod |
Increase memory limit |
| ImagePullBackOff | kubectl describe pod |
Fix image tag or auth |
| CrashLoop with exit 1 | kubectl logs --previous |
Debug app startup |
| Probe failure | kubectl describe pod |
Adjust probe settings |
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro