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

  1. Check Pod status: kubectl get pod.
  2. Describe the Pod for events: kubectl describe pod.
  3. Check logs: kubectl logs and kubectl logs --previous.
  4. Verify resource limits and image availability.
  5. 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

  • CrashLoopBackOff means the container is repeatedly crashing.
  • ImagePullBackOff means the image cannot be pulled.
  • OOMKilled means the container exceeded its memory limit.
  • Missing ConfigMaps or Secrets cause immediate crashes.