Home > Blockchain >  Kubernetes scheduler
Kubernetes scheduler

Time:10-03

Does the Kubernetes scheduler assign the pods to the nodes one by one in a queue (not in parallel)?

Based on this, I guess that might be the case since it is mentioned that the nodes are iterated round robin.

I want to make sure that the pod scheduling is not being done in parallel.

CodePudding user response:

Short answer

Taking into consideration all the processes kube-scheduler performs when it's scheduling the pod, the answer is yes.

Scheduler and pods

For every newly created pod or other unscheduled pods, kube-scheduler selects an optimal node for them to run on. However, every container in pods has different requirements for resources and every pod also has different requirements. Therefore, existing nodes need to be filtered according to the specific scheduling requirements.

In a cluster, Nodes that meet the scheduling requirements for a Pod are called feasible nodes. If none of the nodes are suitable, the pod remains unscheduled until the scheduler is able to place it.

The scheduler finds feasible Nodes for a Pod and then runs a set of functions to score the feasible Nodes and picks a Node with the highest score among the feasible ones to run the Pod. The scheduler then notifies the API server about this decision in a process called binding.

Reference - kube-scheduler.

The scheduler determines which Nodes are valid placements for each Pod in the scheduling queue according to constraints and available resources.

Reference - kube-scheduler - synopsis.

In short words, kube-scheduler picks up pods one by one, assess them and its requests, then proceeds to finding appropriate feasible nodes to schedule pods on.

Scheduler and nodes

Mentioned link is related to nodes to give a fair chance to run pods across all feasible nodes.

Nodes in a cluster that meet the scheduling requirements of a Pod are called feasible Nodes for the Pod

Information here is related to default kube-scheduler, there are solutions which can be used or even it's possible to implement self-written one. Also it's possible to run multiple schedulers in cluster.

Useful links:

  • Related