Courseiva
Question 466 of 302

CKA Practice Question: Cluster Architecture, Installation and Configuration

Which kubectl command is used to drain a node before performing maintenance?

⚠ Common exam trap

CNCF often tests the distinction between `cordon` (only prevents new pods) and `drain` (evicts existing pods), leading candidates to mistakenly choose `cordon` when the question explicitly requires draining for maintenance.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

kubectl drain node01

The `kubectl drain` command is the correct tool for safely evicting all pods from a node before maintenance. It marks the node as unschedulable (similar to `cordon`) and then gracefully terminates pods, respecting PodDisruptionBudgets, ensuring workloads are rescheduled to other nodes without disruption.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • kubectl cordon node01

    Why it's wrong here

    The `kubectl cordon node01` command only marks the node as unschedulable, preventing new pods from being scheduled onto it, but it does not evict or terminate any of the running pods already on the node. Existing workloads continue running and consuming resources, so the node is not actually prepared for maintenance or shutdown. A cordon is a precursor to draining, not a substitute for it, because you still need to manually move or evict existing pods.

  • kubectl drain node01

    Why this is correct

    The `kubectl drain node01` command is the proper way to prepare a node for maintenance. It cordons the node to make it unschedulable and then evicts all pods on the node (except DaemonSet-managed pods and mirror pods by default) gracefully, respecting PodDisruptionBudgets and terminating containers with proper pre-stop hooks. After the drain completes, the node is both unschedulable and free of workloads, allowing safe maintenance or shutdown. Use flags like --ignore-daemonsets or --delete-emptydir-data when needed, but the base command is the correct starting point.

  • kubectl taint node node01 key=value:NoExecute

    Why it's wrong here

    The `kubectl taint node node01 key=value:NoExecute` command adds a taint that causes pods without a matching toleration to be evicted from that node, but it does not make the node unschedulable in the same way as a drain. New pods that tolerate the taint can still be scheduled onto the node, and even pods that do tolerate the taint will remain running, so this does not guarantee a fully drained node. This is a targeted scheduling/eviction control, not a node-maintenance operation, and it is not equivalent to draining all workloads.

  • kubectl delete node node01

    Why it's wrong here

    The `kubectl delete node node01` command removes the Node object from the Kubernetes API server entirely, which is not a graceful way to prepare a node for maintenance. It does not cordon the node or evict pods with normal termination semantics; instead, it deregisters the node, and if the kubelet on the physical or virtual machine is still running, it will attempt to re-register and the node will reappear. This command is intended for removing a permanently deleted node from the cluster, not for draining workloads before a temporary maintenance event, and it can leave workloads in a disrupted or unknown state.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.