How to troubleshoot Pod crashes?
· Category: Kubernetes
Short answer
Troubleshoot Pod crashes by checking Pod status, events, logs, and exit codes. Common causes include OOM kills, image pull failures, misconfiguration, and application errors.
Steps
- Check Pod status:
kubectl get pod. - Describe the Pod for events:
kubectl describe pod. - Check logs:
kubectl logsandkubectl logs --previous. - Verify resource limits and image availability.
- Check for init container failures.
Example
kubectl get pod mypod -o wide
kubectl describe pod mypod
kubectl logs mypod
kubectl logs mypod --previous
Tips
- Exit code 137 indicates SIGKILL, often from OOM.
- Exit code 1 usually means application startup failure.
- Use ephemeral containers to debug crashed Pods.
Common issues
CrashLoopBackOffmeans the container is repeatedly crashing.ImagePullBackOffmeans the image cannot be pulled.OOMKilledmeans the container exceeded its memory limit.- Missing ConfigMaps or Secrets cause immediate crashes.