<p>I have read up on the Kubernetes docs but I'm unable to get a clear answer on my question. I'm using the official cluster-autoscaler.</p>

<ol>
<li>I have a deployment that specifies one replica should be running. When a pod is terminated (for example, was running on a node that is getting scaled-down) <strong>is the new pod scheduled before the termination begins or after the termination is done?</strong> The docs say that schedule happens when terminating, but don't mention at which phase.</li>
<li>To achieve seamless node scale-down without disruption to any services, I would expect k8 to scale up pods to N+1 replicas (at this point pods are scheduled only to nodes that are not scaling down) and then drain the node. Based on my testing, it first drains, and then schedules any missing pods based on configurations. <strong>Is it possible to configure this behaviour or this is currently not possible to do?</strong></li>
</ol>

<p>From what I understand, seamless updates are easy with RollingUpdate strategy. I have not find the same "Rolling" strategy to be possible for scale-down.</p>

<p><strong>EDIT</strong></p>

<p>TL;DR I'm looking for HA on a) two+ replica deployment and b) one replica deployment</p>

<p>a) Can be achieved by using PDBs. Checkout Fritz's answer. If you need pods scheduled on different nodes, leverage anti-affinity (Marc's answer)</p>

<p>b) If you're okay with short disruption, PDB is the official way to go. If you need a workaround, my answer can be of inspiration.</p>

Klohto
<p>The scale down behavior can be configured with what is called a <a href="https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#how-disruption-budgets-work" rel="nofollow noreferrer">Disruption Budget</a></p>

<p>In your Deployment Manifest you can define <code>maxUnavailable</code> and <code>minAvailable</code> number of Pods during voluntary disruptions like draining nodes.</p>

<p>For how to do it, check out <a href="https://kubernetes.io/docs/tasks/run-application/configure-pdb/#protecting-an-application-with-a-poddisruptionbudget" rel="nofollow noreferrer">the K8s Documentation</a>.</p>
