Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Daemonset pod from a node

Tags:

I have a running DaemonSet which is running on all nodes. I want to remove it from a node in order to completely drain it, as kubectl drain doesn't get rid of them. Without deleting my DaemonSet, what's a good way to temporarily remove those pods from the node? I've tried draining it and deleting the DaemonSet pods, but the DaemonSet will still reschedule them, disregarding that the node is set as Unschedulable: true.

like image 952
vascop Avatar asked Jan 03 '18 13:01

vascop


1 Answers

You need to use --ignore-daemonsets key when you drain kubernetes node:

--ignore-daemonsets=false: Ignore DaemonSet-managed pods.

So, in order to drain kubernetes node with DaemonSets in cluster, you need to execute:

kubectl drain <node_name> --ignore-daemonsets

If you need to Remove DaemonSet pod from a node completely, you can specify a .spec.template.spec.nodeSelector in DaemonSet (the DaemonSet controller will create Pods on nodes which match that node selector) and set that label to all nodes except the one you need to completely drain.

like image 112
nickgryg Avatar answered Oct 05 '22 00:10

nickgryg