How to debug Kubernetes pods stuck in CrashLoopBackOff status?

Asked 15 hours ago 27 views

0

After deploying a new microservice container to Kubernetes, the pod enters a state of CrashLoopBackOff. The container starts, crashes almost immediately, and restarts in an exponential backoff loop. What systematic troubleshooting commands should be used to diagnose why the container keeps failing?

Troubleshooting Steps

Run these standard kubectl commands to retrieve logs and event records:

  • kubectl logs: Fetch recent stdout/stderr output from the failing container
  • kubectl describe pod: Inspect recent cluster events and exit codes
  • kubectl get events: View cluster-wide lifecycle events

Reading Exit Codes

Check the container status details to inspect exit codes:

  • Exit Code 1 or 127: Application error or missing executable script
  • Exit Code 137: Container was terminated by OOMKilled (Out of Memory)
  • Exit Code 139: Segmentation fault within the application code

0 Answers


Write Your Answer