Databases and servers
Kubernetes Requests vs Limits: Scheduling, CPU Throttling and OOM Kills
In short
Getting kubernetes requests vs limits wrong shows up as Pods stuck Pending, slow containers or restarts with OOMKilled. Requests are a placement promise the scheduler checks against node capacity. Limits are enforced at runtime: going over the CPU limit only slows a container, while going over the memory limit can get it killed. Together they also fix the QoS class.
What does a request do before the container starts?
The request is the number the scheduler reads. For each resource, it places a Pod only on a node where the sum of requests from containers already scheduled there, plus the new ones, stays below capacity. Live usage plays no part: a node idling at a few percent CPU still refuses a Pod whose requests do not fit, and the Pod waits with a FailedScheduling event such as insufficient cpu.
Once the Pod lands, the kubelet reserves at least the requested amount for that container. A container may use more than its request whenever the node has spare capacity. Under contention, the CPU request acts as a weight, so larger requests receive more CPU time. The memory request is mainly a scheduling input, though on cgroup v2 nodes the runtime may use it as a hint for memory.min and memory.low.
A Pod is scheduled only when all its requests fit, and its request is the sum of its containers. If you set a limit with no request and no admission default applies, Kubernetes copies the limit into the request, which can make a Pod much harder to place than intended.
What happens at the limit in kubernetes requests vs limits for CPU and for memory?
CPU limits are enforced by throttling. In every scheduling interval the kernel checks whether the cgroup has gone over its limit and, if it has, holds it back until the next slice. The docs call this a hard ceiling and say container runtimes never terminate a container for CPU use. The cost is latency, not restarts.
Memory limits are enforced by the kernel OOM killer, and the docs describe that enforcement as reactive. A container can go past its limit for a while, because the kill happens only when the kernel detects memory pressure. When it does, the kernel typically stops the process that tried to allocate; if that was PID 1 and the container can restart, Kubernetes restarts it and records the reason OOMKilled. That is the exit code covered on the exit code 137 page.
Memory-backed emptyDir volumes count as container memory, so a large tmpfs write can trigger the same kill. Since Kubernetes v1.37, Memory QoS on cgroup v2 is beta and enabled by default, yet the kubelet still sets no memory.high throttle until an administrator sets memoryThrottlingFactor.
Which QoS class do your numbers produce?
The class is computed from the requests and limits when the Pod is created and never changes afterwards. It also sets the oom_score_adj the kubelet gives each container, which matters if the whole node runs out of memory.
- A Burstable container with no memory limit is treated as having the node capacity as its limit.
- Guaranteed Pods are the class the QoS page names for exclusive CPUs under the static CPU manager policy.
- Requests for other resources do not stop a Pod from being BestEffort.
| QoS class | Rule | oom_score_adj |
|---|---|---|
| Guaranteed | Every container has CPU and memory requests and limits above zero, with request equal to limit for both | -997 |
| Burstable | At least one CPU or memory request or limit is set, but the Guaranteed rule is not met | min(max(2, 1000 - 1000 x memory request / node memory), 999) |
| BestEffort | No CPU or memory request or limit on any container | 1000 |
Who is removed first when a node runs short of memory?
Two mechanisms can act, and they rank Pods differently. The kubelet evicts first if it can. On Linux its default hard threshold is memory.available<100Mi, and a hard threshold means no grace period. It picks Pods whose usage exceeds their requests, ordered by Priority and then by how far over the request they are; Pods within their requests go last. The eviction page stresses that the kubelet does not read the QoS class itself, even though the QoS page summarises the result as BestEffort, then Burstable, then Guaranteed.
If memory runs out before the kubelet reclaims any, the kernel OOM killer acts on its own score plus oom_score_adj, so a low-class container using a lot of memory relative to its request dies first. The outcome differs: an evicted Pod is terminated with all its containers and may be replaced elsewhere, while an OOM-killed container can be restarted in place under its restartPolicy.
Can requests and limits change on a running Pod?
Yes. In-place Pod resize has been stable since Kubernetes v1.35, after first appearing in v1.27, and its feature gate is now locked on. You send the change to the Pod /resize subresource, and resizePolicy decides per resource whether the container restarts: NotRequired is the default, RestartContainer forces a restart.
The v1.37 task page lists the limits. Only CPU and memory can change, Windows Pods cannot be resized, Pods under static CPU or Memory manager policies are excluded, and requests or limits cannot be removed once set. A resize that would change the QoS class is rejected, so a Guaranteed Pod must keep requests equal to limits. Shrinking a memory limit without a restart is best effort: the kubelet skips the change if current usage is higher, but a spike right after its check can still end in an OOM kill.
A resize the node cannot grant right now is marked Deferred and retried; one it can never grant is Infeasible. Letting the scheduler preempt lower-priority Pods to make room for a deferred resize is alpha in v1.37 and off by default behind InPlacePodVerticalScalingSchedulerPreemption.
How would I set the two numbers from what the docs say?
- Set memory requests close to steady usage, because both scheduling and the eviction ranking compare usage against them.
- Treat the memory limit as the point where a kill is acceptable, and leave headroom for page cache and tmpfs.
- Give latency-sensitive services enough CPU request for contention; a CPU limit adds throttling but never a restart.
- Reserve Guaranteed for Pods that must be the last to go, and set a Priority on anything you cannot afford to lose, since eviction sorts by it.
- Compare requests with real usage before tuning; if
kubectl topreturns nothing, see the metrics-server fix.
What else do people ask?
Does a CPU limit ever kill a container?
No. The resource management page states that container runtimes do not terminate Pods or containers for excessive CPU usage; the effect is throttling.
Can I resize the resources of a Pod running on Windows nodes?
Not in place. The resize task page lists Windows Pods as unsupported, so the change goes through a new Pod from the updated workload template.
Sources
- Kubernetes docs, Resource Management for Pods and Containers, fetched 2026-11-20
- Kubernetes docs, Pod Quality of Service Classes, fetched 2026-11-20
- Kubernetes docs, Node-pressure Eviction, fetched 2026-11-20
- Kubernetes docs, Resize CPU and Memory Resources assigned to Containers, fetched 2026-11-20
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Built only from four kubernetes.io pages as published on 20 Nov 2026, which describe Kubernetes v1.37. No cluster was run for this page and it quotes no benchmark figures. Managed-cluster defaults (EKS, AKS, GKE), LimitRange and ResourceQuota policies, Pod-level resources and Windows nodes are out of scope. Found a mistake? Tell me.