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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sarthak VarshneyPosted May 23, 2025, 4:09 AM
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:
Then apply it and debug the pod without it restarting again and again.
6. Check container exit code
Run:
This gives you the exit code. For example, 1 usually means there was an error in the app.