I deployed an app using Kubernetes, but one pod is crashing repeatedly. How do I diagnose and fix it?
Loading
I deployed an app using Kubernetes, but one pod is crashing repeatedly. How do I diagnose and fix it?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sarthak VarshneyRank #46 · 32K reputationPosted May 23, 2025, 12:09 AM EDT
If a pod is crashing again and again in Kubernetes, here’s how you can find out what’s wrong and fix it:
1. Check the status of the pod
Run this command:
Look at the STATUS column. If it says CrashLoopBackOff, it means the pod is starting, crashing, and then restarting again.
2. See the logs of the crashing pod
Run:
This shows what’s happening inside the pod before it crashes. For example, maybe the app can't connect to a database, or there's a code error.
3. Describe the pod for more details
Run:
This shows if there are issues like missing config maps, secrets, failed liveness probes, etc.
4. Check if there’s a problem in your app
Common reasons for crashes:
Fix the issue in your code or deployment, and then re-deploy.
5. Temporary: Stop the pod from restarting
If you want to debug the container manually, you can stop it from restarting:
Change your deployment YAML and add this to the container:
restartPolicy: NeverThen apply it and debug the pod without it restarting again and again.
6. Check container exit code
Run:
kubectl get pod -o jsonpath='{.status.containerStatuses[0].state.terminated.exitCode}'This gives you the exit code. For example, 1 usually means there was an error in the app.