A container keeps getting killed with an OOMKilled status even though the host has plenty of free memory. Explain what's actually happening at the Linux level and how you'd reason about it.

technical-conceptual · Senior level · cloud-devops-security

What the interviewer is really asking

Probes whether the candidate understands the kernel primitives behind containers — cgroups enforce resource limits, namespaces provide isolation — and specifically that a cgroup memory limit (memory.max) triggers a cgroup-scoped OOM kill independent of host free memory, plus the memory.high soft-limit throttling behavior, rather than confusing host and container memory.

What to say

What to avoid

Example answers

Strong: OOMKilled with a free host means it's a cgroup limit, not host memory. Containers are cgroups plus namespaces — namespaces decide what the process sees, cgroups decide what it can use — and the memory limit lives in the cgroup. In cgroups v2, memory.max is a hard ceiling, so when the container's working set crosses it the kernel OOM-kills inside that cgroup no matter how much the host has free. So I'd compare real usage to the limit, set memory.high to get throttling before the hard kill, and figure out if it's a true working-set need or a leak before I just raise memory.max.

Weak: If the container got OOM-killed it ran out of memory, so I'd increase its memory limit so it has more headroom. If it keeps happening I'd move it to a bigger node with more RAM so there's enough memory available for it to run.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.