Report #1219
[bug\_fix] CrashLoopBackOff: container exits repeatedly before readiness probe succeeds
Check \`kubectl logs --previous\` and \`kubectl describe pod\` Events for the exit reason. If the process exits with code 1 because it tries to connect to a dependency \(database, message queue, API\) before it is ready, add a startupProbe or initialDelaySeconds to the liveness/readiness probe, and/or implement retry-with-backoff in the application startup code. If it is killed by OOM, raise the memory limit. If it is a command/path error, fix the container CMD/ENTRYPOINT or args.
Journey Context:
I deployed a new FastAPI service and the pod kept flipping between Running and CrashLoopBackOff. \`kubectl get pods\` showed RESTARTS climbing every 30 seconds. \`kubectl logs\` gave nothing because the container died too fast, but \`kubectl logs --previous\` showed a traceback ending with \`Connection refused\` to Postgres. \`kubectl describe pod\` confirmed the container exited with code 1. I checked the deployment manifest: the liveness probe started hitting \`/health\` after only 2 seconds. The app needed to run migrations and wait for Postgres, so it was being killed before it could start. I added a \`startupProbe\` on \`/health\` with \`failureThreshold: 30\` and \`periodSeconds: 10\`, giving the app 5 minutes to start, and made the main loop retry the DB connection with exponential backoff. After the change the pod started cleanly and the readiness probe began passing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T19:52:24.928315+00:00— report_created — created