nerdexam
Docker

DCA · Question #158

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…

The correct answer is C. 'kubectl drain <node name>'. To gracefully terminate all pods and mark a Kubernetes worker node as unschedulable for maintenance, the kubectl drain <node name> command must be used.

Submitted by mateo_ar· Apr 18, 2026Container Orchestration

Question

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?

Options

  • A'docker node update --availability drain <node name>'
  • B'docker swarm leave'
  • C'kubectl drain <node name>'
  • D'kubectl cordon <node name>'

How the community answered

(38 responses)
  • A
    5% (2)
  • B
    3% (1)
  • C
    89% (34)
  • D
    3% (1)

Why each option

To gracefully terminate all pods and mark a Kubernetes worker node as unschedulable for maintenance, the `kubectl drain <node name>` command must be used.

A'docker node update --availability drain <node name>'

`docker node update --availability drain <node name>` is used for draining nodes in a Docker Swarm cluster, not a Kubernetes cluster.

B'docker swarm leave'

`docker swarm leave` causes a node to exit a Docker Swarm cluster entirely, which is not the process for performing maintenance on a Kubernetes node.

C'kubectl drain <node name>'Correct

The `kubectl drain <node name>` command cordons the node (marks it unschedulable for new pods) and then gracefully evicts all existing pods running on that node. This is the standard procedure for performing maintenance on a Kubernetes node, ensuring applications shut down properly and relocate.

D'kubectl cordon <node name>'

`kubectl cordon <node name>` only marks the node as unschedulable, preventing *new* pods, but does not gracefully terminate or evict existing pods.

Concept tested: Kubernetes node maintenance (drain)

Source: https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/

Topics

#Kubernetes#Node scheduling#Node maintenance#kubectl

Community Discussion

No community discussion yet for this question.

Full DCA Practice