A cloud operations engineer needs to safely isolate a malfunctioning node in a Google Kubernetes Engine (GKE) cluster for maintenance while ensuring high application availability. In which correct sequential order should the engineer execute these operational steps?
- 1Execute `kubectl cordon <node-name>` to mark the target node as unschedulable.
- 2Execute `kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data` to evict existing pods.
- 3Execute `kubectl get pods -o wide` to verify all evicted workloads are running on remaining healthy nodes.
- 4Delete or reset the underlying Compute Engine VM instance using `gcloud compute instances delete`.
Answer
The correct sequence is to first mark the node unschedulable (`kubectl cordon`), then gracefully evict workloads (`kubectl drain`), next verify that evicted pods are healthy on remaining cluster nodes (`kubectl get pods`), and finally perform maintenance or deletion on the underlying VM instance (`gcloud compute instances delete`).
Cordoning must be performed first to set the node to unschedulable state, preventing Kubernetes from scheduling new pods onto it during maintenance. Next, draining evicts existing non-DaemonSet workloads so they can be recreated on other healthy nodes. After draining, engineers must verify that all pods have resumed normal execution on alternative nodes before taking destructive or maintenance actions against the underlying VM instance.
Step-by-Step Solution
Key Concept
GKE Node Maintenance and Pod Eviction Sequence
Estimated Time:1m 30s