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
.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
标签:
kubernetes