Kubernetes ResourceQuota caps total CPU, memory and object counts per namespace
Answer: Create a ResourceQuota in each namespace with spec.hard limits such as requests.cpu, limits.memory, pods or count/secrets. A ResourceQuota provides constraints that limit aggregate resource consumption per namespace; requests that would exceed it are rejected with 403 Forbidden.
Example
apiVersion: v1
kind: ResourceQuota
metadata:
name: compute-resources
namespace: myspace
spec:
hard:
requests.cpu: "1"
requests.memory: 1Gi
limits.cpu: "2"
limits.memory: 2Gi
pods: "4"
count/secrets: "10"
kubectl describe quota compute-resources --namespace=myspace
How it works
- A cluster administrator creates at least one ResourceQuota for each namespace, and teams work in different namespaces.
- The quota system tracks usage so it does not exceed the hard limits. A create or update that violates a quota is rejected with HTTP status code
403 Forbiddenand a message naming the constraint. - Neither contention nor changes to quota will affect already created resources.
- If a quota covers
cpuormemory, every new pod in that namespace must set requests or limits for it, or pod creation may be rejected. A LimitRange can force defaults so users don't have to remember.
What can be limited
requests.cpuandrequests.memorycap the sum of requests across all pods in a non-terminal state;cpuandmemorymean the same.pods,servicesandservices.loadbalancersset the total number of those objects that can exist in the namespace.count/<resource>(core API group) orcount/<resource>.<group>caps other kinds, such ascount/podtemplates. These quotas protect against exhaustion of control plane storage, for example from too many large Secrets.
See also
Claims
- id: C1 claim: Quota changes do not affect already created resources. source: S2 evidence: "Neither contention nor changes to quota will affect already created resources."
- id: C2 claim: Quota violations are rejected with 403 Forbidden. source: S2 evidence: "the control plane rejects that request with HTTP status code
403 Forbidden"
- id: C3 claim: Object count quotas protect control plane storage. source: S1 evidence: "These types of quotas are useful to protect against exhaustion of control plane storage."
Sources
- [S1] Resource Quotas. Kubernetes docs. https://kubernetes.io/docs/concepts/policy/resource-quotas/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] resource-quotas.md (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/policy/resource-quotas.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, Resource Quotas; kubernetes/website (GitHub), resource-quotas.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, Resource Quotas; kubernetes/website (GitHub), resource-quotas.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "Kubernetes ResourceQuota caps total CPU, memory and object counts per namespace." iinventedlight Library, iil:note:b6msm3mw, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-resource-quotas/. License: CC-BY-4.0.
@misc{iil_note_b6msm3mw,
author = {{iinventedlight}},
title = {{Kubernetes ResourceQuota caps total CPU, memory and object counts per namespace}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-resource-quotas/},
note = {Permanent ID iil:note:b6msm3mw. 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).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- kubernetes-resource-quotas.table.json (table; CC-BY-4.0)
- kubernetes-resource-quotas.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-resource-quotas.md.