Kubernetes Cordon , Hello Readers…I hope you all are doing fine. In this blog we learn about the concept of CORDON and DRAIN.
So; basically we use these two cordan and drain for node maintenance in Kubernetes.
What is Kubernetes Cordon???
Cordon is the operation marks the nodes in the existing node pool as unschedulable. So; the cordon stop scheduling new pods to these nodes once you mark them as unschedulable.
Now we take a one senario:
Suppose; we have a nodes P1, P2, Pn & if you want to cordoan a node P2 so we can use that command kubectl cordon p2. When we use this command this will prevent any extra pods from being added to the node.
This will not allow any pod entering into the node p2.
Kubernetes Cordon – UnCordon:
If you left the node in the cluster during the maintenance process, you need to run the node. Use kubectl uncordon to notify Kubernetes that a new pod can be rescheduled on the node. This is called a Uncordon in kubernetes.
Illustration of Cordon:
Note: Update your minikube or Start your minikube
1} kubectl get node
2} kubectl cordon minikube
3} kubectl describe node minikube
here we get a unschedulable -> true
4} kubectl get node
5} kubectl get pod
6} kubectl run mayuri2 –image=nginx
7} kubectl get pod
8} kubectl describe pod mayuri2
9} kubectl uncordon minikube
10} kubectl get pod -w
11} kubectl describe pod mayuri2
12} kubectl describe node minikube
So; it is all about Cordon and Uncordon in kubernetes.