<p>I am working on my AKS cluster upgrade which fails because of PodDrainFailure error. I see &quot;Allowed Disruptions&quot; for one of my PDB is zero which can be an issue here.</p>
<p>I checked my deployment settings using &quot;k get deployment &lt;deployment_name&gt;&quot; and I see number of replicas is 1. Changing number of replicas to 2 increases &quot;Allowed Disruptions&quot; to 1 temporarily.</p>
<p>However, the number of replicas under deployment details is reverted back to 1 which in turn changes allowed disruptions back to zero.</p>
<p>I can't figure out why my replica count is being reverted back to 1 even though I am directly editing and saving it in deployment setting. I can see the change is confirmed and new POD is also created, which means my changes are implemented successfully.</p>

Susheel Bhatt
<p>As mentioned in <a href="https://learn.microsoft.com/en-us/azure/aks/upgrade-cluster?tabs=azure-cli" rel="nofollow noreferrer">the doc</a>:</p>
<blockquote>
<p>Ensure that any PodDisruptionBudgets (PDBs) allow for at least 1 pod
replica to be moved at a time otherwise the drain/evict operation will
fail. If the drain operation fails, the upgrade operation will fail by
design to ensure that the applications are not disrupted. Please
correct what caused the operation to stop (incorrect PDBs, lack of
quota, and so on) and re-try the operation.</p>
</blockquote>
<p>If the replica count is going down automatically, you might have a horizontal pod autoscaler (HPA) scaling the deployment down.</p>
<p>Once you have both resources above configured, trigger the upgrade command again.</p>
<p>If you dont want to do any changes to your resources, you can trigger the upgrade command, and monitor the nodes being upgraded, and force delete any pod that isnt getting removed by <code>kubectl delete pod -n &lt;ns&gt; &lt;pod-name&gt; --force --grace-period=0</code></p>
