ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 163 - DCA discussion

Report
Export

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?

A.

'docker swarm leave'

Answers
A.

'docker swarm leave'

B.

'docker node update -availability drain <node name>

Answers
B.

'docker node update -availability drain <node name>

C.

'kubectl drain <node name>'

Answers
C.

'kubectl drain <node name>'

D.

'kubectl cordon <node name>

Answers
D.

'kubectl cordon <node name>

Suggested answer: C

Explanation:

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]

asked 08/11/2024
Alex Amponsah
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first