The application exits on startup
CommonThe most common case, and the least glamorous: the process itself fails. A missing environment variable, an unreachable database at boot, a config file that is not where the code expects, an unhandled exception during initialisation. The container is doing exactly what it was told; the program is wrong.
Confirm
kubectl logs <pod> --previous
A stack trace or fatal error from the run that just died. --previous is the important part: once the container has restarted and is running again, plain kubectl logs shows the new run, which may not have failed yet, while --previous always shows the last run that terminated.
Fix
- Read the actual error. In most cases the container is telling you precisely what is missing.
- Check that every environment variable and mounted file the process reads at startup exists in this namespace.
- If it depends on another service being reachable at boot, either make the dependency optional with retries, or use an init container so the failure is reported honestly instead of as a crash loop.