
Scaling
Kubernetes Resource Limits on Owned Nodes: QoS and OOM
How requests, limits and QoS classes behave on nodes you own: CFS throttling, OOM kills versus kubelet eviction, and how far overcommit can safely go.
Most guidance on requests and limits quietly assumes a cloud bill: when a node is contended, the answer is another node. On hardware you bought, that escape hatch is gone. The node count is a fixed asset for the life of the hardware, and the only way to fit more work onto it is to understand exactly what the kubelet and the kernel do with the numbers in a Pod spec.
Capacity you bought versus capacity you rent
Over-requesting wastes capital you already spent; under-requesting turns into evictions and OOM kills on the nodes you cannot quickly add to. The economics of that trade are covered in the five-year on-premise TCO model, and the horizontal half of the problem (how many replicas, and where they land) in the KEDA and Descheduler article. This piece is the vertical half: how big each container is, and what happens when that number is wrong.
One deliberate omission: there is no recommended overcommit ratio here. Any single multiplier depends on the workload mix it was measured on, and a confident-sounding one gets copied into capacity plans unchecked. What follows is a method. Versions are pinned to Kubernetes 1.37, whose latest patch is v1.37.3; v1.38 is at release candidate, and feature stages can move.
Requests, limits and the three QoS classes
Kubernetes has three QoS classes: Guaranteed, Burstable and BestEffort. A Pod is Guaranteed by one of two paths. Per container, every container needs a memory request and memory limit, both above zero and equal, and the same for CPU. Alternatively, if the Pod uses Pod-level resources (beta and enabled by default since 1.34), the Pod-level memory request must equal the Pod-level memory limit, and likewise for CPU. The test runs on the effective spec: if a container sets a limit but omits the request, and no admission mechanism has defaulted it, Kubernetes copies the limit into the request first. A container with only non-zero CPU and memory limits is therefore Guaranteed. A Pod that sets some requests or limits without meeting either test is Burstable; one that sets none is BestEffort.
Two details catch people. In the upstream QoS helper, when Pod-level CPU or memory resources are set, they alone decide the class. Otherwise the check iterates init containers and then regular containers, so an init container without matching requests and limits drops the whole Pod out of Guaranteed. Ephemeral containers are not in that loop. And because an in-place resize cannot change a Pod's QoS class, which class a Pod lands in at creation is permanent for its lifetime.
apiVersion: v1
kind: Pod
metadata:
name: ledger-writer
spec:
containers:
- name: app
image: registry.example.com/ledger-writer:1.4.2
resources:
requests: { cpu: "2", memory: 4Gi }
limits: { cpu: "2", memory: 4Gi }
---
apiVersion: v1
kind: Pod
metadata:
name: api-gateway
namespace: payments
spec:
containers:
- name: app
image: registry.example.com/api-gateway:3.0.1
resources:
requests: { cpu: 500m, memory: 1Gi }
limits: { memory: 1Gi }The scheduler places Pods by requests alone. It ensures the sum of requests on a node stays below capacity, and it refuses a placement when that check fails even if actual usage on the node is low. The capacity it checks against is Allocatable: Capacity minus kubeReserved, systemReserved and the eviction thresholds. The scheduler does not over-subscribe Allocatable. Limits play no part in placement at all.
CPU limits: what CFS bandwidth control actually does
The CPU request and the CPU limit are different kinds of thing. The request is a weighting: on a contended node, containers with larger requests get more CPU time than those with smaller ones. The limit is a hard ceiling enforced by throttling, and container runtimes never kill a container for using too much CPU. The kubelet enforces that ceiling through CFS bandwidth control, which is on by default (cpuCFSQuota: true) with a 100ms period.
Within each period, a cgroup gets up to its quota in microseconds of CPU time. Once the quota is spent, its threads cannot run again until the next period. A container limited to one CPU gets 100ms of CPU per 100ms period, and that budget is shared across all of its threads. On a node with eight free cores, eight busy threads exhaust it in roughly 12.5ms of wall time, then wait out the period. The deceptive case is the occasional burst that spends the whole quota early and stalls while the rest of the minute stays quiet. Averaged over a minute, the container looks under its limit, yet requests see tail-latency spikes of tens of milliseconds. That is the classic shape of CPU throttling: low average utilisation, bad p99.
A cgroup can also be throttled because its parent's quota is exhausted, even with its own runtime remaining. On cgroup v2 the relevant knobs are cpu.max, which defaults to max 100000 (no limit, 100,000-microsecond period), and cpu.max.burst, which defaults to 0. The default period is still 100ms, but since 1.36 the CustomCPUCFSQuotaPeriod gate is GA and on by default, so the 1.37 kubelet honours cpuCFSQuotaPeriod (1ms to 1s) without enabling anything.
Measuring it needs care about which file you read. throttled_time belongs to cgroup v1. On cgroup v2, cpu.stat exports nr_periods, nr_throttled and throttled_usec, and the kernel documents these as non-hierarchical: they count only throttling caused by this cgroup's own limit. Throttling inherited from an ancestor's quota shows up only in cpu.stat.local, whose throttled_usec reports what the cgroup's runqueues actually incurred. That file is comparatively recent and may be missing on an older node kernel, so the script below checks for it.
#!/usr/bin/env bash
set -euo pipefail
POD="${1:?usage: $0 <pod> [namespace]}"
NS="${2:-default}"
kubectl get pod "$POD" -n "$NS" -o jsonpath='{.status.qosClass}{"\n"}'
# cpu.stat counts only throttling caused by THIS cgroup's own quota.
kubectl exec -n "$NS" "$POD" -- cat /sys/fs/cgroup/cpu.stat |
grep -E '^(nr_periods|nr_throttled|throttled_usec) '
# cpu.stat.local can include throttling inherited from a parent quota.
# A zero nr_throttled above does NOT rule that out. Older kernels lack the file.
kubectl exec -n "$NS" "$POD" -- sh -c \
'if [ -r /sys/fs/cgroup/cpu.stat.local ]; then grep "^throttled_usec " /sys/fs/cgroup/cpu.stat.local; else echo "cpu.stat.local not present on this kernel"; fi'Fleet-wide, the standard signal is cAdvisor's throttled-period counter. As currently implemented, cAdvisor reads cgroup v2 statistics through the opencontainers/cgroups library, which fills its throttling data from cpu.stat, not cpu.stat.local, and cAdvisor exports the counter only for containers that have a CPU quota set. The ratio therefore inherits the own-quota-only scope. If the metrics already flow into a self-hosted Prometheus and Grafana stack, the query is one line:
sum by (namespace, pod, container) (rate(container_cpu_cfs_throttled_periods_total[5m]))
/
sum by (namespace, pod, container) (rate(container_cpu_cfs_periods_total[5m]))Whether to set CPU limits at all is contested. A SoCC 2025 vision paper presents empirical evidence for dropping CPU limits entirely from latency-sensitive applications, while noting they can help in well-reasoned cases such as background jobs. Treat it as a trade-off: without a limit, a container can only take idle CPU above its request, and the request weighting protects its neighbours under contention. With a limit, it is predictable and throttled. For latency-sensitive services in the shared CPU pool, requests sized from evidence with no CPU limit is a defensible default; for batch work, a limit is a cheap fence. Pinned containers are the exception, covered below.
Memory limits: OOM kills are not evictions
Most guidance collapses three distinct events into one.
- The container crosses its own limit. The memory limit becomes cgroup v2
memory.max; when usage reaches it and cannot be reduced, the kernel invokes the OOM killer inside that cgroup. On cgroup v2 with the kubelet defaultsingleProcessOOMKill: false, the kubelet setsmemory.oom.groupto1, so every process in the container is killed together. SetsingleProcessOOMKill: trueto get cgroup v1 behaviour, where the kernel typically stops one process that tried to allocate, and the container restarts only if that process was PID 1. QoS class plays no part, and no neighbour is chosen instead. - The node runs out of memory before the kubelet reclaims. Now the node-level kernel OOM killer picks a victim, weighted by the
oom_score_adjthe kubelet assigned:-997for Guaranteed and for containers insystem-node-criticalPods,1000for BestEffort, and for Burstablemin(max(2, 1000 - (1000 × memoryRequestBytes) / machineMemoryCapacityBytes), 999). This is where QoS class matters for memory. - The kubelet evicts under node pressure. When a signal such as
memory.availablecrosses a threshold, the kubelet ranks Pods by whether usage exceeds requests, then by Pod priority, then by usage relative to requests. The eviction docs state plainly that QoS class is not used to rank.
The upstream docs disagree here. The QoS page says Kubernetes evicts BestEffort first, then Burstable, then Guaranteed; the node-pressure eviction page says QoS class does not drive the order. The eviction page describes the mechanism; the QoS ordering usually holds because a BestEffort Pod has no requests and so is always over them, while a Guaranteed Pod cannot exceed requests without hitting its own limit first.
The consequences differ too. An OOM-killed container can be restarted by the kubelet according to its restartPolicy; an evicted Pod is gone from the node. The default Linux hard thresholds are memory.available<100Mi, nodefs.available<10%, imagefs.available<15%, nodefs.inodesFree<5% and imagefs.inodesFree<5%, but they apply only while you change none of them. Set one evictionHard key and the others become zero, unless mergeDefaultEvictionSettings: true is set. That flag defaults to false, so a one-line override can silently remove a node's disk protection.
As of 1.37 there is a fourth lever. The MemoryQoS feature gate is beta and on by default, but the default kubelet configuration enables neither memory throttling nor memory protection. With memoryThrottlingFactor set, Burstable containers get memory.high = requests + factor × (limits - requests); at 0.9, a 256 MiB request and 1 GiB limit yields roughly 947 MiB. With no memory limit, node allocatable memory stands in for the limit; BestEffort uses a zero request and node allocatable; Guaranteed containers get no memory.high. Crossing memory.high throttles and reclaims but never invokes the OOM killer. It needs Linux 5.9 or newer: on older kernels memory.high throttling can livelock, and the kubelet only logs a warning. memoryReservationPolicy: TieredReservation adds protection in three tiers. Guaranteed Pods get memory.min equal to their requests, which the kernel never reclaims. Burstable Pods get memory.low equal to theirs, retained preferentially but reclaimable under extreme pressure; BestEffort Pods get neither. Because a Guaranteed Pod's memory.min equals its memory.max, a large page cache may not be reclaimable before the hard limit, so size that memory limit with headroom for cache.
Noisy-neighbour isolation on your own nodes
On owned hardware the first neighbour to protect is the node itself. Reserve memory for the operating system and the kubelet, and write every eviction threshold out. reservedSystemCPUs only removes its cores from Allocatable and from exclusive assignment: Burstable, BestEffort and fractional Guaranteed containers still run on them unless cpuManagerPolicyOptions sets strict-cpu-reservation: "true". The static CPU manager policy then gives exclusive cores to containers in Guaranteed Pods with integer CPU requests, such as ledger-writer above. On 1.37 DisableCPUQuotaWithExclusiveCPUs is locked on: for a pinned container the kubelet sets CFS quota to unlimited and the cpuset is the cap, so ledger-writer is never quota-throttled. Fractional Guaranteed, Burstable and BestEffort containers share the remaining pool. That is the strongest CPU isolation upstream Kubernetes offers, and it is one more place where QoS class does matter.
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
# reservedSystemCPUs is an explicit core list. It replaces the CPU amount that
# systemReserved/kubeReserved would otherwise compute, so none is set below.
reservedSystemCPUs: "0-1"
systemReserved:
memory: 2Gi
ephemeral-storage: 10Gi
kubeReserved:
memory: 1Gi
ephemeral-storage: 5Gi
# Every hard threshold is listed: setting one zeroes the unlisted ones
# unless mergeDefaultEvictionSettings is true.
evictionHard:
memory.available: 500Mi
nodefs.available: 10%
nodefs.inodesFree: 5%
imagefs.available: 15%
imagefs.inodesFree: 5%
# Changing cpuManagerPolicy or its options on an existing node: drain it,
# delete /var/lib/kubelet/cpu_manager_state, then restart the kubelet.
cpuManagerPolicy: static
cpuManagerPolicyOptions:
strict-cpu-reservation: "true"
singleProcessOOMKill: false
# memory.high throttling needs Linux 5.9+; older kernels can livelock.
memoryThrottlingFactor: 0.9
memoryReservationPolicy: TieredReservationThe figures are illustrative; size reservations from what the node's daemons actually use. If the CPU manager policy changes without a drain and checkpoint removal, the kubelet refuses to start with configured policy "static" differs from state checkpoint policy "none". Roll it out node by node.
Between tenants, the guardrails are namespaced. A LimitRange gives every container a default request and limit, so nothing lands as BestEffort by accident; a ResourceQuota caps the namespace's total requests, so one team cannot claim the cluster's Allocatable. Where tenants need stronger walls than a namespace, vCluster-based hard multi-tenancy layers on top of the same mechanics.
apiVersion: v1
kind: LimitRange
metadata:
name: container-defaults
namespace: payments
spec:
limits:
- type: Container
defaultRequest: { cpu: 250m, memory: 256Mi }
default: { memory: 512Mi }
---
apiVersion: v1
kind: ResourceQuota
metadata:
name: payments-requests
namespace: payments
spec:
hard:
requests.cpu: "24"
requests.memory: 96GiRight-sizing from evidence: VPA, Goldilocks and KRR
Safe density rests on requests that reflect measured usage. Three self-hostable tools do that job differently.
- Vertical Pod Autoscaler runs in-cluster and can act. Its modes:
Offcomputes recommendations only;Initialsets requests at Pod creation;Recreateis the default and evicts to apply;Autois deprecated and currently equalsRecreate.InPlaceOrRecreate, GA since VPA v1.6.0, resizes in place and falls back to eviction;InPlace, alpha in VPA 1.7.0+ behind a feature gate, never evicts. - Goldilocks creates recommendation-mode VPAs for workloads in namespaces labelled
goldilocks.fairwinds.com/enabled=trueand shows them on a dashboard;--on-by-defaultcovers every namespace not excluded by--exclude-namespaces. - KRR is a CLI that reads Prometheus history and needs no in-cluster agent. It requires Prometheus 2.26+, kube-state-metrics and cAdvisor. Its default
simplestrategy looks back 14 days, recommends the CPU request at the 95th percentile with no CPU limit, and sets both memory request and memory limit to the observed maximum plus 15%.
One constraint spans all three: VPA should not run alongside an HPA scaling on the same CPU or memory metric, and KRR returns ? for such a resource unless --allow-hpa is passed. Start with VPA in recommendation mode, compare its numbers with KRR's, and only then let anything write to a Pod spec.
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: api-gateway
namespace: payments
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: api-gateway
updatePolicy:
# Recommendations only. InPlaceOrRecreate (GA) can follow once trusted;
# InPlace is alpha and needs VPA 1.7.0+ with its feature gate.
updateMode: "Off"When a recommendation is accepted, in-place resize (stable since 1.35) applies it without a restart. Memory-limit decreases are the risky direction: the kubelet makes only a best-effort attempt to avoid an OOM kill.
#!/usr/bin/env bash
set -euo pipefail
kubectl -n payments patch pod api-gateway --subresource resize --patch \
'{"spec":{"containers":[{"name":"app","resources":{"requests":{"cpu":"750m"}}}]}}'
# PodResizePending with reason Deferred (retry later) or Infeasible (never on this node).
kubectl -n payments get pod api-gateway \
-o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'How far overcommit can go when nodes are a fixed asset
Never overcommit requests: the scheduler will not let you anyway. Overcommit limits deliberately: the sum of limits on a node may exceed Allocatable, because not every container peaks together. Decide in advance who loses: Pod priority is the second eviction key, so a PriorityClass per tier turns an eviction storm into a predictable shedding order. Size requests from evidence, refreshed on a schedule, so the first eviction key, usage over requests, lands on the workloads that actually grew.
Swap is a cushion, not capacity, and narrower than it looks. NodeSwap is stable since 1.34, but NoSwap is the default. Under LimitedSwap on cgroup v2, the 1.37 kubelet grants swap only to a Burstable container that requests memory, whose memory request differs from its limit, in a Pod that is not critical: not static, not mirror, and below priority 2000000000. Its share is proportional to its memory request over node memory. BestEffort, Guaranteed and critical Pods get none, and so does the api-gateway shape recommended above, with memory request equal to limit. If unit economics matter, OpenCost showback prices that headroom per namespace.
The audit and exit angle
Density decisions are risk decisions, and an auditor will ask how they are controlled. Everything in this article is evidence that can live in git: the KubeletConfiguration with its reservations and complete eviction thresholds, LimitRanges and ResourceQuotas per namespace, PriorityClasses with a written shedding order, and VPA or KRR reports showing requests were sized from measured usage. A change to any of them is a reviewed diff, not a console click.
Requests, limits, QoS, eviction and CPU management are upstream Kubernetes on the upstream Linux kernel, so the workload objects (Pod resources, LimitRange, ResourceQuota, PriorityClass, VerticalPodAutoscaler) run on any conformant cluster, including a managed one. The kubelet file does not travel the same way: the static CPU manager, reservedSystemCPUs, eviction thresholds and MemoryQoS need kubelet access a managed control plane often withholds. The same holds for KubeVirt virtual machines, whose launcher Pods are scheduled and evicted by the same rules. Optionality survives because the tuning lives in open configuration, not in a vendor's autoscaler.
A sizing discipline that lasts a hardware cycle
Requests drift as code and traffic change, so a one-time tune decays. Make the review a loop tied to the hardware lifecycle: a periodic KRR or VPA recommendation pass, a look at throttle ratios and OOM kills per namespace, a check that reservations still match what the node daemons use, and a fresh sum of requests against Allocatable before every capacity purchase. The nodes are a long-lived asset; owning the hardware means owning the arithmetic that fills it.
§FAQ/Common questions
Frequently asked
Does a Kubernetes memory limit cause eviction?
No. Crossing a container's own memory limit triggers the kernel OOM killer inside that container's cgroup; on cgroup v2 the kubelet by default kills the whole container as a group, and it can be restarted per its restartPolicy. Eviction is a separate kubelet action under node pressure, ranked by usage over requests, then Pod priority, then usage relative to requests.
Does QoS class decide which Pods the kubelet evicts first?
Not directly. The node-pressure eviction docs state that QoS class is not used to rank Pods. QoS does set oom_score_adj for the node-level OOM killer, and it gates exclusive cores under the static CPU manager, MemoryQoS protection tiers and LimitedSwap eligibility.
Why is my container CPU-throttled when its average usage is low?
CFS bandwidth control grants quota per 100ms period, shared across all threads. Outside exclusively pinned cores, a multi-threaded burst can spend the whole quota early in the period and wait for the rest; if such bursts are occasional, average utilisation stays low while tail latency suffers. It can also be throttled by a parent cgroup's quota, which only cpu.stat.local reveals on cgroup v2.
How much can I safely overcommit an on-premise Kubernetes node?
There is no portable ratio. Never overcommit requests, since the scheduler packs by them against Allocatable. Overcommit limits deliberately, size requests from measured usage with VPA or KRR, and define PriorityClasses so the shedding order under pressure is a decision rather than an accident.
Further reading
- KEDA and Descheduler: two-tier autoscaling on bare metal
- Repatriation cost: a five-year TCO model you can defend
- OpenCost: Kubernetes namespace showback and chargeback
- Hard multi-tenancy with vCluster: retire 30 clusters
- KubeVirt: the VMware exit for VMs you cannot containerise
- Self-hosted Grafana vs Datadog: Kubernetes observability
- Platform and infrastructure engineering
Executive Briefing
Thirty minutes to clarify your infrastructure risk
Walk us through your vendor footprint and regulatory constraints. We will tell you honestly where sovereignty creates leverage — and where it does not. No pitch deck. No obligation.