Cordoning and draining Kubernetes nodes
You learn kubectl commands to cordon and drain the nodes in the Kubernetes cluster.
Cordon and drain the nodes ageorge-cdsw-4.com and ageorge-cdsw-5.com from the Kubernetes
cluster using kubectl commands.
[root@ageorge-cdsw-1 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
ageorge-cdsw-1.com Ready master 42m v1.19.15
ageorge-cdsw-2.com Ready <none> 42m v1.19.15
ageorge-cdsw-3.com Ready <none> 42m v1.19.15
ageorge-cdsw-4.com Ready <none> 42m v1.19.15
ageorge-cdsw-5.com Ready <none> 41m v1.19.15
[root@ageorge-cdsw-1 ~]# kubectl cordon ageorge-cdsw-4.com
node/ageorge-cdsw-4.cc-os.cloudera.com cordoned
[root@ageorge-cdsw-1 ~]# kubectl cordon ageorge-cdsw-5.com
node/ageorge-cdsw-5.com cordoned
[root@ageorge-cdsw-1 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
ageorge-cdsw-1.com Ready master 47m v1.19.15
ageorge-cdsw-2.com Ready <none> 47m v1.19.15
ageorge-cdsw-3.com Ready <none> 47m v1.19.15
ageorge-cdsw-4.com Ready,SchedulingDisabled <none> 47m v1.19.15
ageorge-cdsw-5.com Ready,SchedulingDisabled <none> 46m v1.19.15
kubectl drain ageorge-cdsw-4.com --ignore-daemonsets --delete-local-data --force
kubectl drain ageorge-cdsw-5.com --ignore-daemonsets --delete-local-data --force