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: without it you get the container that is currently waiting to start, which has produced no output yet.
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.