debugMajorpending
Kubernetes OOMKilled -- understanding memory limits
Viewed 0 times
OOMKilledmemory limitresourcescgroupsMaxRAMPercentagemax-old-space-size
kubernetesdocker
Error Messages
Problem
Pod is killed with OOMKilled status. Container restarts repeatedly. Application works locally but crashes in Kubernetes.
Solution
The container exceeded its memory limit. Debug: (1) kubectl describe pod -- check Last State: OOMKilled. (2) Check actual memory usage: kubectl top pod. (3) Common causes: memory limit too low (increase resources.limits.memory), memory leak in app, JVM not respecting container limits (use -XX:MaxRAMPercentage=75), Node.js needs --max-old-space-size. (4) Set requests close to actual usage, limits 20-50% higher. (5) Use metrics-server or Prometheus to track actual consumption over time.
Why
Kubernetes enforces memory limits via cgroups. When a container exceeds its limit, the kernel OOM killer terminates it immediately (no graceful shutdown).
Revisions (0)
No revisions yet.