Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Docker Exam DCA Topic 4 Question 83 Discussion

Actual exam question for Docker's DCA exam
Question #: 83
Topic #: 4
[All DCA Questions]

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?

Show Suggested Answer Hide Answer
Suggested Answer: C

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]

Contribute your Thoughts:

Selene
6 months ago
I believe `kubectl cordon ' only marks the node as unschedulable without gracefully terminating the pods. So, the correct answer should be C.
upvoted 0 times
...
Tiffiny
6 months ago
But what about option D) `kubectl cordon '? Would that also work for marking the node as unschedulable?
upvoted 0 times
...
Beata
6 months ago
I agree with Dianne. Running `kubectl drain ' will gracefully terminate all pods on the node.
upvoted 0 times
...
Dianne
7 months ago
I think the correct answer is C) `kubectl drain '.
upvoted 0 times
...
Vernell
7 months ago
Yes, `kubectl cordon ' can mark the node as unschedulable, but `kubectl drain ' is the better choice for gracefully terminating pods.
upvoted 0 times
...
Jose
7 months ago
But isn't `kubectl cordon ' also a valid command to mark the node as unschedulable?
upvoted 0 times
...
Dulce
7 months ago
I agree with Vernell, using `kubectl drain ' will gracefully terminate all pods on the node.
upvoted 0 times
...
Vernell
7 months ago
I think the answer is C) `kubectl drain '.
upvoted 0 times
...

Save Cancel