What You Will Learn
Beginner
- How requests and limits work
- QoS classes
- Best practices
Terminalyaml
spec:
containers:
- name: app
image: my-app
resources:
requests: # What the scheduler reserves
cpu: "100m" # 100 millicores (0.1 CPU)
memory: "128Mi"
limits: # Maximum the container can use
cpu: "500m" # 500 millicores (0.5 CPU)
memory: "256Mi"Requests vs Limits
Requests = what the scheduler RESERVES (guaranteed). Limits = MAXIMUM the container can use (hard cap). If a container exceeds its memory limit, it gets OOM-killed.QoS Classes
| Class | When | Priority |
|---|---|---|
| Guaranteed | requests = limits | Highest (last to be evicted) |
| Burstable | requests < limits | Medium |
| BestEffort | No requests/limits | Lowest (first evicted) |
Practical Exercise
Create a Pod with requests and limits
Apply and check: kubectl describe pod
Look at QoS class
Try exceeding memory limit (Pod gets OOM-killed)
Check: kubectl get pod -o wide
Key Takeaways
- Requests: what scheduler reserves. Limits: max allowed.
- CPU: 100m = 0.1 CPU. Memory: 128Mi = 128 MB.
- Exceeding memory limit = OOM kill. Exceeding CPU limit = throttled.
- QoS: Guaranteed (requests=limits) is best.
- Always set requests and limits in production.
Comments
Comments
Post a Comment