CKAD field manual
k8s requests limits YAML example
requests is what the scheduler reserves. limits is the runtime cap. Set both on the container.
kubectl set resources deploy web --requests=cpu=100m,memory=128Mi --limits=cpu=200m,memory=256Mi
apiVersion: v1
kind: Pod
metadata:
name: web
spec:
containers:
- name: web
image: nginx:1.27
resources:
requests:
cpu: "100m"
memory: 128Mi
limits:
cpu: "200m"
memory: 256Mi
kubectl describe po web | grep -A6 Limits
kubectl top po web
Fields
- requests
- What the scheduler guarantees. The Pod stays Pending if no node has that much free.
- limits
- Cap. Memory over → OOMKilled. CPU over → throttle, no kill.
- cpu
- "100m" is 0.1 core. Quote it. 1 is one full core.
- memory
- 128Mi, not 128m. m is millicores. Mi is mebibytes.
- kubectl set resources
- Patches a live Deployment. Triggers a rollout.
Watch
- requests = scheduling. limits = cap. Memory over limit → OOMKilled. CPU over limit → throttle.
- 128Mi is memory. 128m is 0.128 CPU. Mixing them is a common exam miss.
- request == limit on every container → QoS Guaranteed. HPA CPU targets the request, not the limit.
Official docs Resource Management