Interview Prep/Kubernetes/Resources, OOM, probes and termination

During every rollout, the old Pods take exactly 30 seconds to die and logs show the app never received `SIGTERM`.

IntermediateTroubleshootingResources, OOM, probes and termination
Answer

Likely causes → PID 1 in the container is a shell (CMD npm start or sh -c "java ...") that does not forward signals. The app never sees SIGTERM and gets SIGKILL after terminationGracePeriodSeconds (30s default), dropping in-flight requests.

Diagnose →

kubectl exec web-x -- ps -o pid,args | head -3

Fix → Use exec-form CMD and exec in wrapper scripts:

CMD ["node", "server.js"]
# or in entrypoint.sh: exec java -jar /app.jar

Or add tini as init (ENTRYPOINT ["tini", "--"]).

Prevent → Graceful shutdown test in CI: send SIGTERM and assert the process exits cleanly within a few seconds.

All Kubernetes questions Roadmap: Kubernetes core

More on Resources, OOM, probes and termination