k8wiz
Kubernetes
Medium
Commands

Which command would you use to drain a node for maintenance?

Select your answer:

Show answer and explanation

Answer: kubectl drain <node-name>

Explanation

The 'kubectl drain <node-name>' command safely evicts all pods from a node before you perform maintenance on it. It marks the node as unschedulable to prevent new pods from being scheduled to it, and then evicts the pods to other nodes.

Read more about Kubernetes