`kubectl describe pod` shows `Last State: Terminated, Reason: OOMKilled, Exit Code: 137`.
BeginnerTroubleshootingResources, OOM, probes and termination
Answer
Likely causes → The container exceeded its memory limit and the kernel cgroup OOM killer ended it. Causes: limit too low for normal load, a memory leak, a traffic spike, or a runtime that sizes itself from host memory instead of the cgroup.
Diagnose →
kubectl get pod api-x -o jsonpath='{.spec.containers[0].resources}'
kubectl top pod api-x --containers
# Prometheus: container_memory_working_set_bytes{pod="api-x"} vs the limit over 24h
Fix → If usage grows steadily until the kill, it is a leak: take a heap dump and fix the code. If it plateaus just above the limit, raise the limit (and the request) to observed peak plus 20–30%.
Prevent → Alert when working set exceeds 85% of the limit; set requests equal to limits for memory on critical services so the scheduler reserves what they really use.
More on Resources, OOM, probes and termination
A Java service is OOMKilled at 2 GiB limit but the heap is only `-Xmx1800m`.IntermediateMany Pods on one node were killed at once and the node shows a `SystemOOM` event. Container limits were not reached.AdvancedPods show `Evicted` with `The node was low on resource: memory. Threshold quantity: 100Mi, available: 87Mi. Container app was using 1.4Gi, request is 256Mi`.IntermediateA Pod is evicted with `Pod ephemeral local storage usage exceeds the total limit of containers 1Gi`.Intermediatep99 latency spikes every few seconds, CPU usage graph shows only 40% of the limit.AdvancedPods restart every few minutes with `Liveness probe failed: Get "http://10.0.3.17:8080/healthz": context deadline exceeded (Client.Timeout exceeded while awaiting headers)`.Intermediate