Kubernetes Pod Scheduling: Resource Requests
Resource requests tell the scheduler how much CPU and memory a pod needs. The scheduler only places a pod on a node that has enough unallocated capacity to satisfy the request. A pod with requests that no node can fit stays Pending indefinitely.
Resource Management for Pods and Containers - Kubernetes Docs
Verify the cluster and check available capacity:
kubectl get nodes
kubectl describe nodes | grep -A5 "Allocated resources"
Task 1 - Schedule With Requests
Deploy a workload pod with explicit resource requests. The scheduler uses these to find a node with enough free capacity.
Steps:
- Create pod named
workload, imagenginx:alpine - Resource requests:
cpu: 100m,memory: 64Mi
kubectl get pod workload -o wide
Hint: resource requests structure
containers:
- name: <name>
image: <image>
resources:
requests:
cpu: <cpu>
memory: <memory>
Task 2 - Trigger Pending
Deploy an oversized pod that requests more CPU than any node can provide. Observe why it stays Pending.
Steps:
- Create pod named
oversized, imagenginx:alpine - Resource requests:
cpu: 128(128 cores - no node has this)
kubectl get pod oversized
kubectl describe pod oversized | grep -A5 Events
The events section explains why the scheduler could not place it.
Hint: pod with requests
containers:
- name: <name>
image: <image>
resources:
requests:
cpu: <cpu>
Task 3 - Fix the Requests
Deploy a fixed pod with the same image but a realistic CPU request that fits on a node.
Steps:
- Create pod named
fixed, imagenginx:alpine - Resource requests:
cpu: 100m,memory: 64Mi
kubectl get pod fixed -o wide
Hint: pod with requests
containers:
- name: <name>
image: <image>
resources:
requests:
cpu: <cpu>
memory: <memory>
This challenge is part of the Kubernetes Pod Scheduling skill path.