An operations engineer manages a production Google Kubernetes Engine (GKE) Standard cluster named `prod-cluster` in zone `us-central1-a`. The cluster currently runs a batch processing deployment on an on-demand node pool named `batch-pool-v1`. To optimize infrastructure costs, the team must convert this workload to run on Spot VMs without causing service interruption. The engineer attempts to execute an in-place update command on `batch-pool-v1` to convert its VM provisioning type to Spot VMs, but the operational update fails. Which procedure should the engineer perform to successfully transition the workload to Spot VMs?
- Create a new node pool named `batch-pool-v2` with the `--spot` flag using `gcloud container node-pools create`, cordon and drain the nodes in `batch-pool-v1` using `kubectl`, and then delete `batch-pool-v1`.Answer
- BExecute `kubectl autoscale deployment batch-app --enable-spot-instances --min=2 --max=10` to instruct the Horizontal Pod Autoscaler to provision Spot nodes automatically.
- CRun `gcloud container node-pools update batch-pool-v1 --cluster=prod-cluster --zone=us-central1-a --enable-spot` to force a rolling update of the underlying compute instances.
- DUpdate the cluster configuration to GKE Autopilot mode using `gcloud container clusters update prod-cluster --enable-autopilot`, which automatically converts all existing standard node pools to Spot VM pools.
Answer
Create a new node pool named `batch-pool-v2` with the `--spot` flag using `gcloud container node-pools create`, cordon and drain the nodes in `batch-pool-v1` using `kubectl`, and then delete `batch-pool-v1`.
GKE node pools cannot modify their VM provisioning model (such as switching from On-Demand to Spot VMs) after creation. The standard operational procedure requires creating a new node pool configured with the `--spot` flag, cordoning and draining the existing nodes to smoothly migrate running pods to the new capacity, and subsequently deleting the old node pool.
Step-by-Step Solution
Key Concept
GKE Node Pool Immutability and Blue-Green Workload Migration
Estimated Time:2m 0s