Kubernetes pods restart every few hours after a new release, with exit code 137. What's going on?
BeginnerScenarioDeployments and releases
Answer
Situation read → Exit 137 is SIGKILL, almost always OOMKilled. Restarts every few hours point to a memory leak or a too-low limit after the release.
What I'd do →
- Confirm:
kubectl describe pod api-xyz -n prod | grep -A3 "Last State"
# Reason: OOMKilled
- Plot
container_memory_working_set_bytesfor the pod: a steady climb is a leak; a sudden spike is a big request or batch. - Compare with the previous release; if the memory profile changed, it's a regression.
- Short term: raise the limit or roll back. For JVMs check
-XX:MaxRAMPercentage, since the heap may not respect container limits as configured. - Long term: heap profiles, then fix the leak.
Why → Raising the limit only buys time on a leak; it will still OOM, just later.
Interview tip → Distinguish container OOMKill (limit hit) from node-pressure eviction (status Evicted).
More on Deployments and releases
A deploy went out and p99 latency doubled. Walk me through it.IntermediateYou deployed a new version and half the pods are in CrashLoopBackOff. What do you do?BeginnerA release passed every test in staging but broke in production. How do you investigate?IntermediateHow would you design a zero-downtime deployment for a stateless API on Kubernetes?BeginnerEvery deploy causes a short spike of 502 errors from the ALB. Why, and how do you fix it?IntermediateHow would you set up a canary release, and what decides whether it gets promoted?Intermediate