Bird
0
0

Which kubectl command is used to safely evict pods from a node before performing an upgrade?

easy📝 Syntax Q3 of 15
Kubernetes - Production Best Practices
Which kubectl command is used to safely evict pods from a node before performing an upgrade?
Akubectl drain <node-name> --ignore-daemonsets --delete-local-data
Bkubectl cordon <node-name>
Ckubectl delete node <node-name>
Dkubectl upgrade node <node-name>
Step-by-Step Solution
Solution:
  1. Step 1: Use kubectl drain

    This command safely evicts pods from the node, preparing it for maintenance or upgrade.
  2. Step 2: Add flags --ignore-daemonsets --delete-local-data

    These flags ensure daemonset pods are ignored and local data is deleted if necessary to avoid blocking the drain.
  3. Final Answer:

    kubectl drain <node-name> --ignore-daemonsets --delete-local-data -> Option A
  4. Quick Check:

    Command must evict pods safely before upgrade [OK]
Quick Trick: Drain nodes with ignore-daemonsets to avoid blocking pods [OK]
Common Mistakes:
  • Using 'kubectl cordon' which only marks node unschedulable
  • Deleting the node instead of draining
  • Using a non-existent 'kubectl upgrade' command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes