<p>excuse me for asking something that has much overlap with many specific questions about the same knowledge area. I am curious to know if kubernetes will scale a pod in order to evict it.</p>
<p>Given are the following facts at the time of eviction:</p>
<ol>
<li><p>The pod is running one instance.</p>
</li>
<li><p>The pod has an HPA controlling it, with the following params:</p>
<ul>
<li>minCount: 1</li>
<li>maxCount: 2</li>
</ul>
</li>
<li><p>It has a PDB with params:</p>
<ul>
<li>minAvailable: 1</li>
</ul>
</li>
</ol>
<p>I would expect the k8s controller to have enough information to safely scale up to 2 instances to meet the PDB, and until recently I was assuming it would indeed do so.</p>
<p>Why am I asking this? (The question behind the question ;)</p>
<p>Well, we run into auto-upgrade problems on AKS because it won't evict pods as described above, and the Azure team told me to change the params. But if no scaling happens, this means we have to set minAvailable to 2, effectively increasing pod amount only for future evictions. I want to get to the bottom of this before I file a feature request with k8s or a bug with AKS.</p>

Morriz
<p>I believe these two parts are independent; the pod disruption budget doesn't look at the autoscaling capability, or otherwise realize that a pod is running as part of a deployment that could be temporarily upscaled.</p>
<p>If you have a deployment with <code>replicas: 1</code>, and a corresponding PDB with <code>minAvailable: 1</code>, this will prevent the node the pod is running on from being taken out of service.  (I see this behavior in the system I work on professionally, using a different Kubernetes environment.)</p>
<p>The way this works normally (see also  the <a href="https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pdb-example" rel="nofollow noreferrer">PodDisruptionBudget example</a> in the Kubernetes documentation):</p>
<ol>
<li>Some command like <code>kubectl drain</code> or the cluster autoscaler marks a node as going out of service.</li>
<li>The pods on that node are terminated.</li>
<li>The replication controller sees that some replica sets have too few pods, and creates new ones.</li>
<li>The new pods get scheduled on in-service nodes.</li>
</ol>
<p>The pod disruption budget only affects the first part of this sequence; it would keep <code>kubectl drain</code> from actually draining a node until the disruption budget could be satisfied, or cause the cluster autoscaler to pick a different node.  HPA isn't considered at all, nor is it considered that it's &quot;normal&quot; to run extra copies of a deployment-managed pod during upgrades.  (That is, this is a very reasonable question, it just doesn't work that way right now.)</p>
<p>My default setup for most deployments tends to be to use 3 replicas and to have a pod disruption budget requiring at least 1 of them to be available.  That definitely adds some cost to operating the service, but it makes you tolerant of an involuntary node failure and it does allow you to consciously rotate nodes out.  For things that read from message queues (Kafka or RabbitMQ-based workers) it could make sense to run only 1 replica with no PDB since the worker will be able to tolerate an outage.</p>
