<p>I've pods with two replicas, does it make sense that k8s will reschedule  <strong>both replicas in the same time</strong>?
if yes is there a way to avoid it ?</p>
<p>I guess(according to the replies from @Henry) that I need to use <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity" rel="noreferrer">https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity</a> or</p>
<p>topology
<a href="https://kubernetes.io/blog/2020/05/introducing-podtopologyspread/" rel="noreferrer">https://kubernetes.io/blog/2020/05/introducing-podtopologyspread/</a></p>
<p>But not sure how to configure following:</p>
<p><code>1</code> application with <code>2</code> replicas that for example</p>
<p><code>Replica A</code> runs on <code>nodeFoo</code> and</p>
<p><code>Replica B</code> run in <code>NodeBar</code></p>

Jenny M
<p>To configure the replicas  to run on different nodes <code>podAntiAffinity</code> can be used. For example in the deployment spec:</p>
<pre><code>spec:    
  template:
    metadata:
      labels:
        name: my-app-label
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels:
                  name: my-app-label
              topologyKey: kubernetes.io/hostname
</code></pre>
<p>This basically means, all pods matched by the label <code>name=my-app-label</code> should run on hosts where the node label <code>kubernetes.io/hostname</code> is different.</p>
