9/945 min
Config & Health
LimitRange & ResourceQuota
Control resource consumption per namespace: set defaults per container and total budgets per namespace.
intermediate45 minRead β Lab β Quiz β Practice
π§ Brain Warm-Up
π§ Brain Warm-Up: A shared cluster has 10 teams. Without any controls, one team could deploy 1000 pods and starve everyone else. What two mechanisms would you use: one for defaults, one for hard caps?
Two Complementary Mechanisms
LimitRange β Per-Container Defaults and Limits
Applied per container in a namespace. If a container has no requests/limits set, LimitRange injects defaults.
Container without requests/limits
β LimitRange injects defaults
Container with cpu: 100m/500m, memory: 128Mi/512MiAlso enforces:
min/max: containers must stay within these boundsmaxLimitRequestRatio: limits cannot be more than NΓ requests
ResourceQuota β Namespace-Level Budget
Hard caps on total resources in a namespace. The scheduler rejects any pod that would exceed the quota.
ResourceQuota: requests.cpu: 4 β total CPU requests across all pods limits.memory: 8Gi β total memory limits count/pods: 20 β max 20 pods
Why Both?
- LimitRange prevents pods with no limits (which can consume unlimited resources)
- ResourceQuota prevents a namespace from growing beyond its budget
QoS Classes (Side Effect)
When you set requests = limits, the pod gets Guaranteed QoS. When requests < limits, it gets Burstable. No requests/limits = BestEffort (evicted first under pressure).