<p>What should I do with pods after adding a node to the Kubernetes cluster?</p>

<p>I mean, ideally I want some of them to be stopped and started on the newly added node. Do I have to manually pick some for stopping and hope that they'll be scheduled for restarting on the newly added node?</p>

<p>I don't care about affinity, just semi-even distribution.</p>

<p>Maybe there's a way to always have the number of pods be equal to the number of nodes?</p>

<p><strong>For the sake of having an example:</strong></p>

<p>I'm using juju to provision small Kubernetes cluster on AWS. One master and two workers. This is just a playground.</p>

<p>My application is apache serving PHP and static files. So I have a deployment, a service of type NodePort and an ingress using nginx-ingress-controller.</p>

<p>I've turned off one of the worker instances and my application pods were recreated on the one that remained working.</p>

<p>I then started the instance back, master picked it up and started nginx ingress controller there. But when I tried deleting my application pods, they were recreated on the instance that kept running, and not on the one that was restarted.</p>

<p>Not sure if it's important, but I don't have any DNS setup. Just added IP of one of the instances to /etc/hosts with host value from my ingress.</p>

<p><a href="https://github.com/kubernetes-incubator/descheduler" rel="nofollow noreferrer">descheduler</a>, a kuberenets incubator project could be helpful. Following is the introduction</p>
<p>As Kubernetes clusters are very dynamic and their state change over time, there may be desired to move already running pods to some other nodes for various reasons:</p>
<ul>
<li>Some nodes are under or over utilized.</li>
<li>The original scheduling decision does not hold true any more, as taints or labels are added to or removed from nodes, pod/node affinity requirements are not satisfied any more.</li>
<li>Some nodes failed and their pods moved to other nodes.</li>
<li><strong>New nodes are added to clusters.</strong></li>
</ul>
