Room 39
RESOURCE QUOTAS
The Rationing Chamber
- ResourceQuotas limit total resources a namespace can consume.
- A namespace has hit its quota. Find out what’s blocked and get the password.
📜 Mission Briefing
- Create namespace
rationedand applyquota.yaml. - The quota limits: max 5 pods, 2 CPU, 2Gi memory.
- Deploy pods until the quota is exhausted.
- Check quota usage:
kubectl get resourcequota -n rationed. - The quota has an annotation with the password:
quota42.
Key Commands
| Command | Purpose |
|---|---|
kubectl get quota -n NS | View quotas |
kubectl describe quota NAME -n NS | Quota usage details |
kubectl create quota NAME --hard=pods=10,cpu=4 | Create quota |
How ResourceQuotas Work
apiVersion: v1
kind: ResourceQuota
metadata:
name: namespace-quota
namespace: rationed
annotations:
escape-password: "quota42"
spec:
hard:
pods: "5"
requests.cpu: "2"
requests.memory: "2Gi"
limits.cpu: "4"
limits.memory: "4Gi"
services: "5"
services.loadbalancers: "1"
persistentvolumeclaims: "5"
requests.storage: "10Gi"
configmaps: "10"
secrets: "10"
# Quota scopes:
# - Compute: cpu, memory (requests and limits)
# - Object: pods, services, configmaps, secrets, PVCs
# - Storage: requests.storage, PVCs per storage class
# When quota is set for cpu/memory, ALL pods MUST specify requests/limits
# Check quota usage
kubectl get resourcequota -n rationed
kubectl describe resourcequota namespace-quota -n rationed
# Used Hard
# ---- ----
# pods 3 5
# cpu 1500m 2
# Quota with scopes
apiVersion: v1
kind: ResourceQuota
metadata:
name: priority-quota
spec:
hard:
pods: "10"
scopeSelector:
matchExpressions:
- operator: In
scopeName: PriorityClass
values: ["high"]
Hints
Hint 2
Hint 3
The password is quota42.