Kubernetes LimitRange sets default and min/max CPU and memory per container in a namespace
Answer: Create a LimitRange in the namespace with default, defaultRequest, min and max for type: Container. A LimitRange is a policy that constrains the limits and requests you can specify for each object kind, such as Pod or PersistentVolumeClaim, in a namespace.
Example
apiVersion: v1
kind: LimitRange
metadata:
name: cpu-resource-constraint
spec:
limits:
- type: Container
default:
cpu: 500m
defaultRequest:
cpu: 500m
max:
cpu: "1"
min:
cpu: 100m
What it can enforce
- Minimum and maximum compute resource usage per Pod or Container.
- Minimum and maximum storage request per PersistentVolumeClaim.
- A ratio between request and limit for a resource.
- Default requests and limits, injected automatically into containers that set none.
Admission rules
- First the LimitRange admission controller applies defaults to Pods without compute resource requirements; then it checks minimum, maximum and ratio.
- A Pod or PersistentVolumeClaim that violates a constraint fails with HTTP status code
403 Forbidden. - Validation happens only at Pod admission. If you add or modify a LimitRange, the Pods that already exist continue unchanged.
- With two or more LimitRange objects in a namespace, it is not deterministic which default value will be applied.
- A LimitRange does not check that its defaults are consistent. A default limit below a container's request, such as a 500m limit with a 700m request, makes the Pod not schedulable.
Why use it
By default, containers run with unbounded compute resources. A ResourceQuota caps the namespace total, while a LimitRange makes sure a single object cannot monopolize all available resources within the namespace and fills in defaults that quotas require.
See also
Claims
- id: C1 claim: Containers run with unbounded compute resources by default. source: S1 evidence: "By default, containers run with unbounded"
- id: C2 claim: LimitRange validation occurs only at Pod admission. source: S2 evidence: "LimitRange validations occur only at Pod admission stage, not on running Pods."
- id: C3 claim: Multiple LimitRanges make the applied default nondeterministic. source: S2 evidence: "it is not deterministic which default value will be applied"
Sources
- [S1] Limit Ranges. Kubernetes docs. https://kubernetes.io/docs/concepts/policy/limit-range/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] limit-range.md (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/policy/limit-range.md . License: CC-BY-4.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Limit Ranges; kubernetes/website (GitHub), limit-range.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Limit Ranges; kubernetes/website (GitHub), limit-range.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "Kubernetes LimitRange sets default and min/max CPU and memory per container in a namespace." iinventedlight Library, iil:note:1pcqqnqk, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-limit-ranges/. License: CC-BY-4.0.
@misc{iil_note_1pcqqnqk,
author = {{iinventedlight}},
title = {{Kubernetes LimitRange sets default and min/max CPU and memory per container in a namespace}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-limit-ranges/},
note = {Permanent ID iil:note:1pcqqnqk. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-limit-ranges.md.