In this training, we will learn about how to drain and uncordon a node.
Navigate to the folder
19_nodedrain
from CLI, before you get started.
kubectl create -f .
-
Get the node
kubectl get pods -o wide
-
Drain the node, where the pod
my-pod
is runningkubectl drain <NODE-NAME>
This will get aborted due to
my-daemonset
andmy-pod
-
Try again
kubectl drain <NODE-NAME> --ignore-daemonsets --force
-
Take a look at the pods on that node
kubectl get pods -o wide
Note that the pod
my-pod
has gone forever. The pods for the deploymentmy-deployment
got rescheduled to the other node and the pods for the daemonsetmy-daemonset
are untouched.
kubectl uncordon <NODE-NAME>
Note that the pod
my-pod
really has gone forever. The uncordon operation does not cause any re-scheduling happening.
kubectl delete deployment my-deployment
kubectl delete daemonset my-daemonset