<p>I am going to implement PDB on AKS. Can someone please tell me why do we need it when we can use node autoscaler.</p>
<p>Also, does PDB allow zero unavailability by creating a node when one of the nodes fails?</p>

Rahul
<p><a href="https://kubernetes.io/docs/tasks/run-application/configure-pdb/" rel="nofollow noreferrer">PDB</a> allows you to set rules before evicting your pods from a node.</p>
<p>Let's say you have a 2 nodes cluster and a deployment with 1 replica and you want to update your nodes.</p>
<ul>
<li><code>kubectl drain</code> will cordon <code>node 1</code> so no pods can be schedule on that node</li>
<li><code>kubectl drain</code> will remove the pod schedule on <code>node 1</code></li>
<li><code>kubelet</code> will then deploy your pod over <code>node 2</code></li>
</ul>
<p>Now if you set a <code>PDB</code> with a <code>minAvailable: 50%</code>, that <code>drain</code> command would fail as it would violates the rule.</p>
<p>The pods is killed and <strong>then</strong> kubelet tries to schedule it somewhere.</p>
<p>PDB allows you to prevent downtime by budgeting pods before evicting them.</p>
<p><strong>Scenario without PDB</strong></p>
<p>You perform <code>node 1</code> update and <code>node 2</code> cannot host the evicted pod :</p>
<ul>
<li>pod is killed on <code>node 1</code></li>
<li>kubelet cannot schedule pod anywhere</li>
<li>autoscaling provisions a third node</li>
<li>pod is scheduled on that new node</li>
</ul>
<p>During that whole time your evicted pod was not running anywhere and your application was down.</p>
