Main Menu

Search

KUBERNETES: How To Put Kubernetes Node In Maintenance Mode?

 Following are steps to put Kubernetes node in maintenance mode

1. Verify if there are any pods running on the Kubernetes control/worker node which has to be placed in maintenance mode. For this run below command on Control node 1.


kubectl get pods --all-namespaces -owide 


2. Drain the Kubernetes control/worker node which has to be placed in maintenance mode, so that running pods on the node are moved and scheduled on other nodes. For this run below command on Control node 1.


kubectl drain <node>


In case there are any daemonset pods running on the node which has to be put in maintenance mode, use below kubectl command to drain the node.


kubectl drain <node> --ignore-daemonsets


3. Cordon the Kubernetes control/worker node which has to be put in maintenance mode. For this run below command on control node 1.


kubectl cordon <node>


To remove maintenance mode on Kubernetes control/worker node and put it back to service, uncordon the node. For uncordoning the node run below command from control node 1.


kubectl uncordon <node>

No comments:

Post a Comment