<p>Does <code>kubectl drain</code> first make sure that pods with <code>replicas=1</code> are healthy on some other node?<br>
Assuming the pod is controlled by a deployment, and the pods can indeed be moved to other nodes.
Currently as I see it only evict (delete pods) from the nodes, without scheduling them first.</p>

<p>In addition to <a href="https://stackoverflow.com/users/8803619/suresh-vishnoi">Suresh Vishnoi</a>  answer:</p>

<p>If <a href="https://kubernetes.io/docs/tasks/run-application/configure-pdb/" rel="noreferrer">PodDisruptionBudget</a> is not specified and you have a deployment with one replica, the pod will be terminated and <strong>then</strong> new pod will be scheduled on a new node.</p>

<p>To make sure your application will be available during node draining process you have to specify PodDisruptionBudget and create more replicas. If you have 1 pod with <code>minAvailable: 30%</code> it will refuse to drain with following error: </p>

<pre><code>error when evicting pod "pod01" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
</code></pre>

<p>Briefly that's how draining process works:</p>

<p>As explained in documentation <code>kubectl drain</code> command "safely evicts all of your pods from a node before you perform maintenance on the node and allows the pod’s containers to gracefully terminate and will respect the <code>PodDisruptionBudgets</code> you have specified” </p>

<p>Drain does two things:</p>

<ol>
<li><p>cordons the node- it means that node is marked as unschedulable, so new pods cannot be scheduled on this node. Makes sense- if we know that node will be under maintenance there is no point to schedule a pod there and then reschedule it on another node due to maintenance. From Kubernetes perspective it adds a taint to the node: <code>node.kubernetes.io/unschedulable:NoSchedule</code></p></li>
<li><p>evicts/ deletes the pods-  after node is marked as unschedulable it tries to evict the pods that are running on the node. It uses <a href="https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/#the-eviction-api" rel="noreferrer">Eviction API</a> which takes <code>PodDisruptionBudgets</code> into account (if it's not supported it will delete pods). It calls DELETE method to K8S but considers <code>GracePeriodSeconds</code> so it lets a pod finish it's processes. </p></li>
</ol>
