Skip to content

Commit e2e50d0

Browse files
authored
Merge pull request #38917 from guettli/patch-11
Add `--ignore-daemonsets` to docs of `kubectl drain`
2 parents e49c18f + c192062 commit e2e50d0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

content/en/docs/tasks/administer-cluster/safely-drain-node.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,16 @@ kubectl get nodes
6666
Next, tell Kubernetes to drain the node:
6767

6868
```shell
69-
kubectl drain <node name>
69+
kubectl drain --ignore-daemonsets <node name>
7070
```
7171

72+
If there are pods managed by a DaemonSet, you will need to specify
73+
`--ignore-daemonsets` with `kubectl` to successfully drain the node. The `kubectl drain` subcommand on its own does not actually drain
74+
a node of its DaemonSet pods:
75+
the DaemonSet controller (part of the control plane) immediately replaces missing Pods with
76+
new equivalent Pods. The DaemonSet controller also creates Pods that ignore unschedulable
77+
taints, which allows the new Pods to launch onto a node that you are draining.
78+
7279
Once it returns (without giving an error), you can power down the node
7380
(or equivalently, if on a cloud platform, delete the virtual machine backing the node).
7481
If you leave the node in the cluster during the maintenance operation, you need to run

0 commit comments

Comments
 (0)