Question

Difficulty: MediumManaging Google Kubernetes Engine Resources

You need to manually migrate running microservice workloads from an existing Google Kubernetes Engine (GKE) node pool to a newly created node pool with minimal disruption. Arrange the following operational steps in the correct execution sequence.

  1. 1Provision the target node pool within the GKE cluster using gcloud container node-pools create.
  2. 2Mark the existing nodes in the original node pool as unschedulable using kubectl cordon.
  3. 3Evict running pods from the original nodes using kubectl drain --ignore-daemonsets.
  4. 4Remove the old node pool from the GKE cluster using gcloud container node-pools delete.

Answer

The correct sequence is: provision the new node pool (gcloud container node-pools create), cordon the original nodes (kubectl cordon), drain the original nodes (kubectl drain), and delete the empty node pool (gcloud container node-pools delete).
Safe workload migration between GKE node pools requires creating the new node pool first so target capacity exists. Next, cordoning the old nodes ensures no new pods land on them. Draining the old nodes then evicts running workloads, allowing Kubernetes to reschedule them onto the new node pool. Finally, deleting the old node pool cleans up unused GCP resources.

Step-by-Step Solution

1
Create target node pool
A new node pool is created and attached to the cluster.
Target capacity must be active before evicting workloads from the original nodes to avoid unschedulable pod states.
2
Cordon old nodes
The old nodes are marked with SchedulingDisabled status.
Prevents newly incoming pods or restarted pods from being assigned to the nodes undergoing decommission.
3
Drain old nodes
Pods are safely evicted from old nodes and rescheduled onto the new node pool.
kubectl drain triggers a graceful eviction process that respects PodDisruptionBudgets.
4
Delete original node pool
The old node pool and underlying Compute Engine instances are deleted.
Once all workloads are confirmed to be running on the new node pool, the old infrastructure can be safely removed.

Key Concept

Manual GKE Node Pool Migration and Node Lifecycle Management
Estimated Time:1m 30s
Rate this question