<p>I can only find documentation online for attaching pods to nodes based on labels.
Is there a way to attach pods to nodes based on labels and count - So only x pods with label y?</p>

<p>Our scenario is that we only want to run 3 of our API pods per node.
If a 4th API pod is created, it should be scheduled onto a different node with less than 3 API pods running currently.</p>

<p>Thanks</p>

<p>No, you can not schedule by <em>count</em> of a specific <em>label</em>. But you can avoid co-locate your pods on the same node.</p>

<h2>Avoid co-locate your pods on same node</h2>

<p>You can use <code>podAntiAffinity</code> and <code>topologyKey</code> and <code>taints</code> to avoid scheduling pods on the same node. See <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#never-co-located-in-the-same-node" rel="nofollow noreferrer">Never co-located in the same node
</a></p>
