Report #99618
[bug\_fix] CrashLoopBackOff: container exits repeatedly after pod startup
Read the previous container's logs with \`kubectl logs --previous\` \(or \`kubectl logs -c --previous\`\) to find the actual exit reason, then fix the underlying application error or misconfiguration. If the container exits before logs are captured, add a short \`command: \["sh", "-c", "sleep 3600"\]\` override temporarily, exec in with \`kubectl exec\`, and run the entrypoint by hand to reproduce the failure.
Journey Context:
A deployment rolled out and the new pods showed \`CrashLoopBackOff\` with rapidly climbing restart counts. \`kubectl describe pod\` only showed \`Back-off restarting failed container\` with an exit code of 1, which is generic. The current logs \(\`kubectl logs\`\) were empty because the container died before it could write anything. The previous logs revealed a Python traceback: the app was reading \`DATABASE\_URL\` from an environment variable that was not defined in the new container spec, so it panicked at startup. The pod spec had no default value and no liveness probe, so Kubernetes kept restarting the dead container with exponential backoff. Once the missing env var was added to the Deployment, the container started cleanly and the backoff cleared. The key insight is that CrashLoopBackOff is a symptom, not a root cause; the actual failure is almost always in the previous container's logs or in the container's startup behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:46:43.414987+00:00— report_created — created