You are running only Kubernetes workloads on a worker node that requires
maintenance, such as installing patches or an OS upgrade.
Which command must be run on the node to gracefully terminate all pods on
the node, while marking the node as unschedulable?
The command kubectl drain <node name> is the correct one to run on the node to gracefully terminate all pods on the node, while marking the node as unschedulable. This command will safely evict all the pods from the node before you perform maintenance on the node, such as installing patches or an OS upgrade1. It will respect the PodDisruptionBudgets you have specified, if any, and allow the pod's containers to gracefully terminate1. It will also mark the node as unschedulable, so that no new pods can be scheduled on the node until it is ready1.
The other commands are not correct because:
* docker swarm leave will make the node leave the swarm cluster, but it will not affect the Kubernetes workloads on the node2.
* docker node update -availability drain <node name> will change the availability of the node to drain, which means that no new tasks can be assigned to the node, but it will not terminate the existing pods on the node3.
* kubectl cordon <node name> will mark the node as unschedulable, but it will not evict the pods on the node4.
* Safely Drain a Node | Kubernetes
* [docker swarm leave | Docker Docs]
* [docker node update | Docker Docs]
* [kubectl cordon | Kubernetes Docs]
Selene
5 months agoTiffiny
5 months agoBeata
5 months agoDianne
6 months agoVernell
6 months agoJose
6 months agoDulce
6 months agoVernell
6 months ago