Kubernetes: Quality of Service for Pods

2 min read

On Kubernetes there are three QOS (Quality of Service) classes that a Pod can use. We can check what's the class it's using by checking the qosClass under status:

$ kubectl get pod pet2cattle-swag-746956854c-62psn -n website -o jsonpath='{.status.qosClass}'

These three classes are:

  • Guaranteed: Pods are considered high-priority, will only be killed if they exceed their resource requests when other containers require their resources.
  • Burstable: Pods have some minimum guaranteed resources and are configured so they can exceed them. They are more likely to be killed than Guaranteed pods.
  • BestEffort: These are the lowest-priority pods, that will be the first to be evicted when the node runs out of resources.

To set a Pod to the Guaranteed QoS class it needs to meet the following criteria:

  • Each container must have a CPU and memory limit set to the same value than the CPU and memory limit: The same amount of CPU/mmemory that is requesting is also the maximum it is allowed to use.

If the Pod does not meet this criteria, then we can check whether it meets the Burstable criteria:

  • At least one container in the Pod has a memory or CPU request

If this is true, it is assigned to the Burstable class, otherwise is assigned to the BestEffort class

Posted on 10/11/2021