<p>my Kubernetes setup:</p>

<ul>
<li>v1.16.2 on bare metal</li>
<li>1 master node: used for Jenkins Master + Docker registry</li>
<li>5 slave nodes: used for Jenkins JNPL slaves</li>
</ul>

<p>I use kubernetes-plugin to run slave docker agents. All slave k8 nodes labeled as "jenkins=slave". When I use nodeSelector ("jenkins=slave") for podTemplate, kubernetes always schedule new pod on same node  regardless the amount of started Jenkins jobs.</p>

<p>Please give me advice, how I can configure kubernetes or kubernetes-plugin to schedule each next build by round-robin (across all labeled nodes in kubernetes cluster)</p>

<p>Thank you.</p>

Yaroslav Berezhinskiy
<p>This is generally handled by the inter-pod anti affinity configuration <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity</a>. You would set this in the pod template for your builder deployment. That said, it's more common to use the Kubernetes plugin for Jenkins which runs each build as a temporary pod, rather than having long-lived JNLP builders.</p>
