Challenge, Easy,  on  Kubernetes

Kubernetes Pod Scheduling: Quality of Service Classes

When a node runs low on resources, Kubernetes uses QoS classes to decide which pods to throttle and which to evict. The class is not set directly - Kubernetes derives it from the requests and limits configured on each container.

Pod Quality of Service Classes - Kubernetes Docs

Task 1 - BestEffort

Deploy a pod with no resource requests or limits. Kubernetes assigns it BestEffort - the lowest QoS class. These pods are the first to be evicted under memory pressure.

Steps:

  • Create pod named best-effort, image nginx:alpine
  • No resource requests or limits
kubectl get pod best-effort -o jsonpath='{.status.qosClass}'

Task 2 - Burstable

Deploy a pod where requests are set but lower than limits. Kubernetes assigns it Burstable - the pod is guaranteed its requested resources but can use more if available. Evicted after BestEffort pods.

Steps:

  • Create pod named burstable, image nginx:alpine
  • Resource requests: cpu: 100m, memory: 64Mi
  • Resource limits: cpu: 500m, memory: 256Mi
kubectl get pod burstable -o jsonpath='{.status.qosClass}'
Hint: requests and limits
resources:
  requests:
    cpu: <cpu>
    memory: <memory>
  limits:
    cpu: <cpu>
    memory: <memory>

Task 3 - Guaranteed

Deploy a pod where every container has requests equal to limits for both CPU and memory. Kubernetes assigns it Guaranteed - the highest QoS class. These pods are the last to be evicted.

Steps:

  • Create pod named guaranteed, image nginx:alpine
  • Resource requests and limits both set to: cpu: 200m, memory: 128Mi
kubectl get pod guaranteed -o jsonpath='{.status.qosClass}'
Hint: requests equal to limits
resources:
  requests:
    cpu: <cpu>
    memory: <memory>
  limits:
    cpu: <cpu>
    memory: <memory>

This challenge is part of the Kubernetes Pod Scheduling skill path.