Question

Difficulty: MediumManaging Google Kubernetes Engine Resources

A cloud engineer needs to migrate workloads from an existing GKE Standard node pool to a new node pool configured with larger machine types without causing application downtime. In what sequence should the engineer execute these operational steps to perform the migration?

  1. 1Provision the new node pool in the GKE cluster using `gcloud container node-pools create`.
  2. 2Cordon the nodes in the old node pool using `kubectl cordon`.
  3. 3Evict running Pods from the old node pool using `kubectl drain`.
  4. 4Delete the old node pool using `gcloud container node-pools delete`.

Answer

The correct operational sequence is: first, provision the new node pool; second, cordon the old nodes to block new Pod assignments; third, drain the old nodes to migrate running Pods to the new pool; and fourth, delete the old node pool.
To migrate GKE workloads seamlessly to a new node pool without downtime, the target infrastructure must exist first (`gcloud container node-pools create`). Next, cordoning the old nodes (`kubectl cordon`) ensures that no new Pods land on nodes scheduled for removal. Draining the old nodes (`kubectl drain`) then gracefully terminates existing Pods so Kubernetes reschedules them on the newly available nodes. Finally, after all Pods are running healthily on the new node pool, the old node pool can be safely deleted (`gcloud container node-pools delete`).

Step-by-Step Solution

1
Create the destination node pool
Additional compute capacity is added to the cluster to receive workloads.
You cannot migrate running Pods off existing nodes unless replacement node capacity already exists.
2
Mark old nodes as unschedulable (cordon)
Old nodes stop accepting new Pod assignments.
Cordoning prevents new or rescheduled Pods from placing themselves back onto the nodes slated for removal.
3
Evict Pods gracefully (drain)
Pods are safely terminated and recreated on the new node pool by their controller deployments.
Draining respects PodDisruptionBudgets and allows graceful termination of application processes.
4
Decommission the old node pool
Unused compute resources are removed from Google Cloud, stopping billing for the old nodes.
Deleting the node pool is the final step after verifying all workloads are running in the new pool.

Key Concept

Zero-downtime GKE Node Pool Migration using Cordon and Drain
Rate this question