1

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

Kubernetes uses QoS classes to make decisions about scheduling and evicting Pods.

I don't understand how do QoS classes have anything to do with scheduling? The documentation mentions that QoS classes determine eviction order in case of a node going out of resources.

On the other hand, scheduling uses pod priorities (PriorityClass) to set the scheduling order and preemption.

My question is what is the link between QoS and scheduling?

woj.sierak
  • 513
  • 6
  • 17
  • 1
    Would it be anything to do with https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ – woj.sierak Apr 14 '21 at 21:49

1 Answers1

1

My question is what is the link between QoS and scheduling?

According to https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/

kube-scheduler selects a node for the pod in a 2-step operation:

Filtering
Scoring

The filtering step finds the set of Nodes where it's feasible to schedule the Pod. For example, the PodFitsResources filter checks whether a candidate Node has enough available resource to meet a Pod's specific resource requests. After this step, the node list contains any suitable Nodes; often, there will be more than one. If the list is empty, that Pod isn't (yet) schedulable.

In the scoring step, the scheduler ranks the remaining nodes to choose the most suitable Pod placement. The scheduler assigns a score to each Node that survived filtering, basing this score on the active scoring rules.

Finally, kube-scheduler assigns the Pod to the Node with the highest ranking. If there is more than one node with equal scores, kube-scheduler selects one of these at random.

So the QoS takes a role in Filtering step of kube-scheduler operation that corresponding PodFitsResources filter.

According to https://kubernetes.io/docs/reference/scheduling/policies/

PodFitsResources: Checks if the Node has free resources (eg, CPU and Memory) to meet the requirement of the Pod.

Tinh Huynh
  • 21
  • 3
  • 1
    I'm still not sure about the link between the type of QoS class and PodFitsResources filter. Do you mean that depending on the class the decision might be different, for example, if a pod’s class is BestEffort, any node will pass PodFitsResources filter due to lack of the request value while for Burstable and Guaranteed pods, only the nodes that have enough capacity to accommodate the request value will pass the filter? – woj.sierak Apr 15 '21 at 08:35
  • 1
    You're right! Firstly, PodFitsResources checks the allocatable pods of the node, then the "request" value. You can check out the kube-scheduler PodFitsResources function here (line 783): https://github.com/kubernetes/kubernetes/blob/release-1.17/pkg/scheduler/algorithm/predicates/predicates.go#L783 – Tinh Huynh Apr 15 '21 at 09:14