Question

Difficulty: Very hardManaging Google Kubernetes Engine Resources

A cloud engineer manages a production Google Kubernetes Engine (GKE) Standard cluster hosting both latency-sensitive microservices and fault-tolerant background batch workloads. To reduce compute expenditures, the engineer needs to provision a secondary node pool using GCP Spot VMs for the batch workloads. The implementation must ensure that Cluster Autoscaler dynamically adjusts node counts based on pending pod demand, while strictly preventing latency-sensitive web pods from being scheduled onto Spot instances. Which strategy correctly configures the GKE node pool and workload specifications to satisfy these requirements?

  1. A
    Create the new node pool using gcloud container node-pools create with the --spot flag, configure a Horizontal Pod Autoscaler (HPA) targeting node count metrics to add nodes when unschedulable pods are detected, and define node selectors on the batch workloads.
  2. B
    Migrate the existing GKE Standard cluster to GKE Autopilot mode using gcloud container clusters update, relying on default Autopilot behavior to provision Spot nodes dynamically without setting node taints or workload tolerations.
  3. Create the new node pool using gcloud container node-pools create with the flags --spot, --enable-autoscaling, and --node-taints=cloud.google.com/gke-spot=true:NoSchedule, then add matching tolerations and node affinity to the batch workload Deployment manifests.Answer
  4. D
    Create the new node pool using gcloud container node-pools create with the --spot flag without node taints, and configure higher CPU resource requests on latency-sensitive workloads so the Kubernetes scheduler avoids placing them on Spot nodes.

Answer

Create the node pool with Spot instances, Cluster Autoscaler enabled, and a node taint of cloud.google.com/gke-spot=true:NoSchedule via gcloud, while configuring corresponding tolerations and node affinity in the batch workload specifications.
Combining `--spot`, `--enable-autoscaling`, and `--node-taints` during node pool provisioning ensures that nodes scale automatically when unschedulable pods are queued, while guaranteeing that untolerated latency-sensitive workloads are never scheduled on Spot VMs. Adding tolerations and node affinity to the batch workloads enables them to run on the tainted Spot nodes.

Step-by-Step Solution

1
Identify the node pool creation flags required for Spot VM usage and cluster scaling.
Use `gcloud container node-pools create` with `--spot` for Spot VM pricing and `--enable-autoscaling` to allow Cluster Autoscaler to provision nodes when pods are unschedulable.
Cluster Autoscaler manages node pool scaling based on pending pod resource constraints, while `--spot` requests Spot instances.
2
Enforce node isolation for latency-sensitive workloads.
Apply `--node-taints=cloud.google.com/gke-spot=true:NoSchedule` during node pool creation.
Taints prevent default pods (such as latency-sensitive services) from landing on Spot nodes unless explicit tolerations exist.
3
Configure batch workload specifications to target the Spot node pool.
Add matching tolerations for `cloud.google.com/gke-spot=true:NoSchedule` and node affinity/selectors for Spot nodes to the batch Deployment manifests.
Tolerations permit the batch pods to schedule on tainted Spot nodes, while node affinity directs them specifically to those nodes.

Key Concept

Managing GKE Node Pools with Spot VMs, Cluster Autoscaler, and Taints/Tolerations
Estimated Time:3m 0s
Rate this question