<p>This seems like it should be simple enough, but I haven't been able to find an answer.</p>

<p>We have three labeled nodes:</p>

<p><code>thalia0</code>
<code>thalia1</code>
<code>thalia2</code></p>

<p>and a Deployment spec, named <code>mm-sa</code>.</p>

<p>I would simply like to set number of replicas of <code>mm-sa</code> to 48 and have the scheduler assign 16 pods to each node.</p>

<p>The closest I could find to this, was here, but it looks like this is not yet avaialble: <a href="https://github.com/kubernetes/kubernetes/issues/68981" rel="nofollow noreferrer">Node affinity for even spread of pods across multiple availability zones</a>. I also found this, <a href="https://stackoverflow.com/questions/57035421/why-kubernetes-scheduler-ignores-nodeaffinity">why-kubernetes-scheduler-ignores-nodeaffinity</a>, but it says that "According to the documentation, nodeAffinity must exist for each node that can be used for a scheduled pod and the node having the biggest weight sum is chosen."</p>

<p>This seems like such a simple use-case, but I cannot figure out how to achieve it without using a naïve approach, as in defining 3-different Deployments named <code>mm-sa1</code>, ... <code>mm-sa3</code> and using a <code>nodeSelector</code> to assign each accordingly. (NB: I am currently using a <code>nodeSelector</code> to assign 16-replicas of <code>mm-sa</code> on a single node).</p>

<p>Kubernetes will automatically spread the pods in a replication controller or service across nodes in a single-zone cluster. So @David Maze's solution should apply if there are no other nodes. However since you mentioned that you have other nodes that you do not want to schedule on, I would recommend using the <em>nodeSelector</em>. By using <em>nodeSelector</em>, as long as the node has the same key-value pair in the YAML, the pod will be able to schedule on the node. </p>

<p>You can read more about <em>nodeSelector</em> here: <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector</a></p>
