<p>Let say I have a cluster with 10 worker nodes and the application is randomly deployed to them. I have a namespace X, have 20 instances of nodejs that want to connect to MySQL Group Replication via MySQL Router.<br />
I want to deploy 1 instance of MySQL Router to every node that has at least 1 of my nodejs application. Is this logic support with the k8s default rule?<br />
Ex:</p>
<ul>
<li>node1: 4 nodejs, 1 router</li>
<li>node2: 3 nodejs, 1 router</li>
<li>node3: 12 nodejs, 1 router</li>
<li>node4: 1 nodejs, 1 router</li>
<li>other nodes: no app =&gt; no router</li>
</ul>
<p><a href="https://i.stack.imgur.com/HKm4q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HKm4q.png" alt="enter image description here" /></a></p>

Đinh Anh Huy
<p>Using <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity" rel="nofollow noreferrer">Inter-pod affinity</a>:</p>
<blockquote>
<p>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>
