<p>Does the Kubernetes scheduler assign the pods to the nodes one by one in a queue (not in parallel)?</p>
<p>Based on <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/scheduler-perf-tuning/#how-the-scheduler-iterates-over-nodes" rel="nofollow noreferrer">this</a>, I guess that might be the case since it is mentioned that the nodes are iterated round robin.</p>
<p>I want to make sure that the pod scheduling is not being done in parallel.</p>

Saeid Ghafouri
<h2>Short answer</h2>
<p>Taking into consideration all the processes <code>kube-scheduler</code> performs when it's scheduling the pod, the answer is <strong>yes</strong>.</p>
<h2>Scheduler and pods</h2>
<blockquote>
<p>For <strong>every newly created pod or other unscheduled pods</strong>, kube-scheduler
selects an optimal node for them to run on. However, <strong>every container</strong>
<strong>in pods</strong> 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.</p>
<p>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.</p>
<p>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.</p>
</blockquote>
<p><a href="https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler" rel="nofollow noreferrer">Reference - kube-scheduler</a>.</p>
<blockquote>
<p>The scheduler determines which Nodes are valid placements for <strong>each Pod
in the scheduling queue</strong> according to constraints and available
resources.</p>
</blockquote>
<p><a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/#synopsis" rel="nofollow noreferrer">Reference - kube-scheduler - synopsis</a>.</p>
<p>In short words, <code>kube-scheduler</code> picks up pods one by one, assess them and its requests, then proceeds to finding appropriate <code>feasible</code> nodes to schedule pods on.</p>
<h2>Scheduler and nodes</h2>
<p>Mentioned link is related to nodes to give a fair chance to run pods across all <code>feasible</code> nodes.</p>
<blockquote>
<p>Nodes in a cluster that meet the scheduling requirements of a Pod are
called feasible Nodes for the Pod</p>
</blockquote>
<p>Information here is related to default <code>kube-scheduler</code>, there are solutions which can be used or even it's possible to implement self-written one. Also it's possible to run <a href="https://kubernetes.io/docs/tasks/extend-kubernetes/configure-multiple-schedulers/" rel="nofollow noreferrer">multiple schedulers in cluster</a>.</p>
<h2>Useful links:</h2>
<ul>
<li><a href="https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/#kube-scheduler-implementation" rel="nofollow noreferrer">Node selection in kube-scheduler</a></li>
<li><a href="https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler" rel="nofollow noreferrer">Kubernetes scheduler</a></li>
</ul>
