<p>I have a deployment (called <code>moon2</code>) having 2 replicas (let's say <code>moon2-pod1</code> and <code>moon2-pod2</code>), deployed on Azure Kubeneretes (AKS) where the autocsaling feature is enabled (the min=2, the max=10 for nodes)</p>
<p>And when the cluster scales down, sometimes the workers deploying the pods of the deployment in question get killed, then the pods in question get deployed on other workers.</p>
<p><strong>My question</strong>: How can i avoid the killing of pods <code>moon2-pod1</code> and <code>moon2-pod2</code> ? ie. can i tell AKS: when you scale down, do not delete worker(s) having the 2 pods in question ? If the response is yes, how can i do that ? or is there another way ?</p>
<p>Thank you in advance for your help!</p>

Mohamed
<p>I think Pod Disruption Budget (PDB) is probably what you're looking for. You can set a PDB for pods in your demployment with <code>MaxUnavailable: 0</code> , which means &quot;do not touch any pods for this deployment&quot;.</p>
<p>Please check this doc for more details and how to set it: <a href="https://kubernetes.io/docs/tasks/run-application/configure-pdb/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/configure-pdb/</a></p>
<p>one thing to note is that, with AKS, with a PDB like that, you will need to remove such PDB temporarily before you do version upgrade/node-image update etc, otherwise these operations get stuck, because these nodes cannot be drained for upgrade/update with such pods on it.</p>
