Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsEasy

A platform engineer is performing maintenance on a Kubernetes worker node and needs to temporarily prevent new Pods from being scheduled onto it without affecting existing running Pods. Which `kubectl` command should be used?

  1. A`kubectl delete node`
  2. B`kubectl uncordon`
  3. C`kubectl cordon`
  4. D`kubectl drain`
Show answer & explanation

Correct answer: C. `kubectl cordon`

The `kubectl cordon` command marks a node as unschedulable. This prevents new Pods from being scheduled onto that node while allowing existing Pods to continue running. This is ideal for preparatory steps before maintenance.

Why the other options are wrong

  • A. `kubectl delete node` removes the node from the cluster entirely, which is too aggressive for temporary maintenance.
  • B. `kubectl uncordon` marks a previously cordoned node as schedulable again.
  • D. `kubectl drain` marks a node unschedulable and then evicts all Pods from it, which would affect existing running Pods.

`kubectl cordon`

A `kubectl` command used to mark a Kubernetes node as 'unschedulable', preventing the scheduler from placing new Pods on it while allowing existing Pods to continue running.

  • Marks node unschedulable.
  • New Pods won't be scheduled.
  • Existing Pods are unaffected.

Memory trick: Cordon off the node, but don't kick out the current guests!

More Kubernetes Fundamentals questions