Question

Difficulty: Very hardManaging Google Kubernetes Engine Resources

An organization needs to migrate workloads from an existing GKE Standard node pool to a new node pool featuring larger machine types to handle increased memory demand. To prevent application downtime during the migration, in what sequence should a cloud engineer execute the following operational steps?

  1. 1Provision a new node pool within the existing GKE cluster using the required larger machine type.
  2. 2Cordon all nodes in the old node pool using `kubectl cordon` to mark them as unschedulable.
  3. 3Drain the nodes in the old node pool using `kubectl drain --ignore-daemonsets` to gracefully evict running workloads.
  4. 4Delete the old node pool using `gcloud container node-pools delete` once all workloads have successfully migrated.

Answer

The operational sequence must start with provisioning the new node pool, followed by cordoning the old nodes, draining the old nodes to evict Pods to the new pool, and finally deleting the old node pool.
To achieve zero downtime during node pool replacement in GKE Standard, new compute capacity must be created first. Nodes in the old pool are then cordoned so no new Pods are placed on them. Next, `kubectl drain` gracefully evicts active Pods, causing Kubernetes deployment controllers to recreate them on the newly provisioned node pool. Finally, after verifying all workloads are running safely on the new nodes, the old node pool can be deprovisioned.

Step-by-Step Solution

1
Provision the target node pool
Additional compute capacity with larger machine types becomes available in the cluster.
Before evicting existing workloads, target capacity must be active and available to accept rescheduled Pods without causing resource starvation.
2
Cordon the old nodes
The old nodes are marked with `SchedulingDisabled` status.
Cordoning ensures that new Pod deployments or restarts will not land on the old nodes while migration is prepared.
3
Drain the old nodes
Existing Pods are gracefully evicted and recreated by their controllers on the new node pool.
Draining respects PodDisruptionBudgets and termination grace periods, moving active workloads safely to the new node pool.
4
Delete the old node pool
The old compute resources are deprovisioned from Google Cloud.
Once the old nodes are entirely empty of application workloads, deleting the pool releases compute resources and stops incurring costs.

Key Concept

Zero-downtime GKE Node Pool Migration
Rate this question