Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does a pod with one container of equal requests and limits classify as a Burstable pod?

Tags:

kubernetes

In the kubernetes documentation here the conditions for a pod that is classified as Burstable in regards to resource QOS is defined as

If requests and optionally limits are set (not equal to 0) for one or more resources across one or more containers, and they are not equal, then the pod is classified as Burstable. When limits are not specified, they default to the node capacity.

so basically stated differently:

  1. requests set for one or more resources (cpu/memory) across one or more containers in the pod.
  2. limits are optional: if set, they should be not be equal to the requests of the same resource.

But then later on the documentation gives the following as an example of Burstable pod:

containers:
  name: foo
    resources:
      limits:
        cpu: 10m
        memory: 1Gi
      requests:
        cpu: 10m
        memory: 1Gi

  name: bar

Note: Container bar has no resources specified.

This example fulfils condition 1. However, it doesn't satisfy condition 2, since the limits and requests are set for one container but they are equal.

So why is this pod classified as a Burstable pod?

K8s documentation containing QOS explanation and examples: https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node/resource-qos.md#qos-classes

like image 988
Hesham Massoud Avatar asked Jul 06 '18 09:07

Hesham Massoud


People also ask

What does burstable mean in Kubernetes?

A Pod is given a QoS class of Burstable if: The Pod does not meet the criteria for QoS class Guaranteed. At least one Container in the Pod has a memory or CPU request or limit.

What are burstable pods?

Burstable (QoS)If requests and optionally limits are set (not equal to 0) for one or more resources across one or more containers, and they are not equal, then the pod is classified as Burstable.

Why does Kubernetes use a pod as the smallest deployable unit and not a single container?

Smallest unit in that context means "smallest deployable thing". Technically a container is an even smaller unit because a pod can contain multiple containers, but you can not deploy a single container, only a pod with one container. That's why the pod is considered the smallest unit in kubernetes.

What is the maximum number of containers a pod can have?

No more than 5000 nodes. No more than 150000 total pods. No more than 300000 total containers.


1 Answers

The evaluation of the Quality of Service (QoS) is done by scheduler on the whole pod, i.e. container by container and then taking the lowest evaluation.

Take a look at this example:

apiVersion: v1
kind: Pod
metadata:
  name: class
spec:
  containers:
  - name: container1
    image: busybox
    command: ["sh"]
    args: ["-c","sleep 3600"]
    resources:
      requests:
        memory: 100Mi
        cpu: 200m
      limits:
        memory: 100Mi
        cpu: 200m
  - name: container2
    image: busybox
    command: ["sh"]
    args: ["-c","sleep 3600"]
    resources:
      requests:
        memory: 100Mi
        cpu: 200m

container1 has Guaranteed QoS, because it has both requests and limits defined, and they are equals.

container2 has Burstable QoS, because it hasn't limits defined, but only requests.

class pod is evaluated, based on both containers and taking the lowest evaluation:

min(Guaranteed, Burstable) = Burstable

Reference: https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/

like image 131
Nicola Ben Avatar answered Nov 15 '22 08:11

Nicola Ben