Kubernetes: Quality of Service (QoS) for pods

Quality of service for pod is a concept of resource in Kubernetes that allows us to compute resource management. Cluster administrators can prioritize pods to allocate resource to based of the QoS class. We classify pods as of the following: Guaranteed, Burstable and BestEffort. The QoS classes are used to make decisions about scheduling and evicting pods. A guaranteed pod has the highest priority. A pod is assigned the Guaranted class when the Limit and Request for both CPU and Memory is the same. If a container specifies a limit for CPU or Memory without specifying request for Memory and CPU, Kubernetes automatically assigns a Memory request that matches that limit. Burstable is assigned to a pod when the limit specified is above the request.The Guaranteed Class has a greater priority than Burstable class. Lastly, the BestEffort class is assigned to a pod that does not have limit or request set for both CPU and Memory. Below are examples of pods with each classes.

Guaranteed pod example

apiVersion: v1
kind: Pod
metadata:
  name: guaranteed-class
spec:
  containers:
  - name: qos-example
    image: nginx
    resources:
      limits:
        cpu: 500m
        memory: 350Mi
      requests:
        cpu: 500m
        memory: 350Mi

Burstable pod example

kind: Pod
apiVersion: v1
metadata:
  name: Burstable-class
spec:
  containers:
  - name: burstable-example
    image: nginx
    resources:
      limits:
        memory: "500Mi"
      requests:
        memory: "300Mi"

BestEffort pod example

apiVersion: v1
kind: Pod
metadata:
  name: besteffort
spec:
  containers:
  - name: besteffort-example
    image: nginx

Leave a Reply

Your email address will not be published. Required fields are marked *