Report #3298
[bug\_fix] CrashLoopBackOff: pod starts then exits repeatedly
Read the previous container logs with \`kubectl logs --previous\` to find the application-level panic or exit reason, then fix the underlying code, command, or configuration. If the container exits faster than Kubernetes can attach, add \`command: \['sh', '-c', 'sleep 30'\]\` temporarily to inspect the filesystem and environment, or raise \`initialDelaySeconds\` on liveness probes so a slow-starting app is not killed prematurely.
Journey Context:
I deployed a new service and saw \`CrashLoopBackOff\` in \`kubectl get pods\`. The RESTART count kept climbing. \`kubectl describe pod\` showed the container terminated with exit code 1 but only generic events. I ran \`kubectl logs --previous\` and found the real stack trace: the app panicked because a required environment variable was unset and the config loader called \`os.Exit\(1\)\`. After setting the env var in the Deployment the pod stayed Running. In another case the app was healthy but the liveness probe hit it before it finished schema migrations; raising \`initialDelaySeconds\` stopped Kubernetes from killing it during startup.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T16:28:32.999560+00:00— report_created — created