Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.22 KB

File metadata and controls

51 lines (37 loc) · 1.22 KB

Draining nodes

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.

Create the deployment, pod and daemonset

kubectl create -f .

Drain the node

  • Get the node

    kubectl get pods -o wide
  • Drain the node, where the pod my-pod is running

    kubectl drain <NODE-NAME>

    This will get aborted due to my-daemonset and my-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 deployment my-deployment got rescheduled to the other node and the pods for the daemonset my-daemonset are untouched.

Uncordon the node

kubectl uncordon <NODE-NAME>

Note that the pod my-pod really has gone forever. The uncordon operation does not cause any re-scheduling happening.

Cleanup

kubectl delete deployment my-deployment
kubectl delete daemonset my-daemonset

Jump to Home | Previous Training | Next Training