Kubernetes pods repeatedly OOM-killed even though node has ample free memory — cgroup vs kubelet limit mismatch
Environment
EKS-like on-prem Kubernetes cluster v1.24 running kubelet 1.24, containerd runtime, nodes are 64GB RAM Linux VMs (Ubuntu 22.04) with kube-reserved 1Gi and system-reserved 1Gi configured. A microservice (Go binary) requests 512Mi and sets no memory limit; some pods get restarted by OOM-killer shortly after start although host node free memory remains >10Gi.
Symptoms
Pods show status 'OOMKilled' in kubectl describe and kubelet events show 'Killing container with id ...: container had OOMKilled'. Pods restart repeatedly (CrashLoop). Node-level memory pressure not reported (kubectl top node shows <60% usage). Other pods on same node unaffected.
Observations
- dmesg on node shows 'Out of memory: Kill process <pid> (myapp) score 1000 or sacrifice child' corresponding to container PIDs. - cgroup memory.max for the container path reveals a low effective limit (e.g., ~1Gi) despite pod not specifying a memory limit. - kubelet logs show 'cgroup driver: systemd' and a warning about failing to apply memory limit to system.slice when node memory swap accounting disabled. - Pod's container runtime inspect shows memory limit set to a lower value by CRI; inspecting the pod YAML shows only requests: 512Mi, no limits. - Prometheus Node exporter metrics show memory.available high and no node OOM conditions preceding the container kills.
Already attempted
- Added explicit memory.limits in pod spec to 1Gi; behavior persisted for some pods until limit enforced and then OOM no longer occurred for properly sized containers. - Evicted other low-importance pods to rule out contention. - Rebooted node and recreated pods; problem reappeared on same node. - Compared cgroup driver and kubelet --cgroup-driver settings across nodes; same configuration. - Disabled swap on node (swap was already off).
Question
Why are containers being OOM-killed even though the host reports plenty of free RAM? What node-level or kubelet cgroup configuration should be checked or corrected so that Kubernetes respects pod memory requests/limits and prevents host OOM-kills?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Cloud Computing46% match
Kubernetes pods OOMKilled while node shows 80GB free memory on Ubuntu 20.04 (kubelet+Docker cgroup mismatch suspected)
Open0 answers - Cloud Computing27% match
Kubernetes pods CrashLoopBackOff only on upgraded nodes with hugepages enabled — short lived OOM at container startup
Open0 answers - Cloud Computing27% match
Kubernetes nodes fail to pull container images after containerd overlay storage filled on GKE-like cluster
Open0 answers - Cloud Computing27% match
Kubernetes StatefulSet pods fail to mount Ceph PVCs on nodes upgraded to newer kubelet: 'failed to find device' in kubelet logs
Open0 answers - Cloud Computing23% match
Kubernetes PVCs stuck Pending after node migration — CSI node plugin fails to register with kubelet
Open0 answers