<p>Is there a way to deploy a replica set in Kubernetes on unique nodes?</p>

<p>All the documentation I can find on Kubernetes NodeSelectors, (anti-)affinity, etc., seems to relate to specifying a particular node you do or don't want the pods to be on. I don't mind which nodes my pods are on, I just don't want two pods from a deployment on the same one-- I want to spread them out.</p>

<p>It seems like a simple enough thing to do-- in Mesos you can apply a constraint like "HOSTNAME: unique" to achieve it-- but I can't find the Kubernetes equivalent. Can anyone help, please?</p>

hiiamelliott
<p>In contrast with the first answer described in the comments below your question I'd say the right approach is to define <code>pod anti-affinity</code> as described <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature" rel="nofollow noreferrer">in the docs</a>. More precisely:</p>

<blockquote>
  <p>The rules are of the form “this pod should (or, in the case of anti-affinity, should not) run in an X if that X is already running one or more pods that meet rule Y”.</p>
</blockquote>

<p>Feel free to share your scenario details in order to propose a solution. Of course, if you want to run your deployment on compute plane exclusively or compute + control plane you'd choose <code>Deployment</code> resp. <code>DaemonSet</code> in case of the latter.</p>
