Does kubectl drain remove pod first or create pod first


Kubernetes version 1.12.3. Does kubectl drain remove pod first or create pod first.

-- PengYang

2 Answers


You can use kubectl drain to safely evict all of your pods from a node before you perform maintenance on the node (e.g. kernel upgrade, hardware maintenance, etc.)

When kubectl drain return successfuly it means it has removed all the pods successfully from that node and it is safe to bring that node down(physically shut off, or start maintainence)

Now if you turn on the machine and want to schedule pods again on that node you need to run:

kubectl uncordon <node name>

So, kubectl drain removes pods from the node and don't schedule any pods on that until you uncordon that node

-- Prafull Ladha
Source: StackOverflow


kubectl drain will ignore certain system pods on the node that cannot be killed. The given node will be marked unscheduled to prevent new pods from arriving.

When you are ready to put the node back into service, use kubectl uncordon, which will make the node schedulable again.

For for details use command: kubectl drain --help

With this I hope you will get information which you are looking.

-- Vishal Lahane
Source: StackOverflow