Node Cordon and Drain Operations
Explore this Page
Overview
Efficient management of cluster nodes is crucial for maintaining the stability and performance of a Kubernetes environment. Two important operations that assist in node management are cordon and drain.
- Cordoning a node marks it as unschedulable, preventing the deployment of new resources while allowing existing workloads to continue operating.
- Draining a node not only marks the node as unschedulable but also safely migrates existing volume targets to other nodes.
This document describes how to use the kubectl puls8 mayastor
CLI to perform cordon, uncordon, and drain operations on nodes.
Cordon a Node
Cordoning a node prevents the Kubernetes scheduler from placing new workloads on it, without impacting any resources already running. This operation is aligned with the standard Kubernetes node cordon functionality.
To add a label and cordon a node:
To retrieve a list of all cordoned nodes:
To view the labels associated with a specific cordoned node:
Uncordon a Node
Uncordoning a node marks it as schedulable again, allowing the Kubernetes scheduler to place new resources on it.
To uncordon a node:
Drain a Node
Draining a node makes it unschedulable and safely relocates all volume targets to other nodes. This ensures that the workloads remain highly available. This operation aligns with the Kubernetes node drain functionality.
To initiate the drain operation on a node:
To retrieve a list of nodes that have undergone a drain operation:
To stop an ongoing drain operation or make a drained node schedulable again:
Benefits of Node Cordon and Node Drain
- Prevents new workload deployments on unhealthy or under-maintenance nodes, ensuring stability.
- Safely migrates workloads off a node during maintenance or upgrades, avoiding downtime.
- Helps in node maintenance and upgrades without disrupting existing workloads.
Learn More