Question

Difficulty: MediumManaging Google Kubernetes Engine Resources

A DevOps engineer manages a Google Kubernetes Engine (GKE) Standard cluster named `prod-cluster` located in the `us-central1` region. The application workload experiences dynamic spikes in traffic, causing newly scheduled pods to remain in a `Pending` state whenever existing node capacity is exhausted. The engineer needs to update the existing node pool named `worker-pool` so that GKE automatically provisions or removes worker nodes as capacity demands shift, maintaining between 2 and 10 nodes per zone. Which command should the engineer execute?

  1. gcloud container node-pools update worker-pool --cluster=prod-cluster --region=us-central1 --enable-autoscaling --min-nodes=2 --max-nodes=10Answer
  2. B
    kubectl autoscale deployment worker-pool --min=2 --max=10 --cpu-percent=80
  3. C
    gcloud container clusters update prod-cluster --region=us-central1 --enable-autopilot
  4. D
    gcloud container node-pools update worker-pool --cluster=prod-cluster --region=us-central1 --enable-spot

Answer

The command `gcloud container node-pools update worker-pool --cluster=prod-cluster --region=us-central1 --enable-autoscaling --min-nodes=2 --max-nodes=10` enables GKE Cluster Autoscaler on the specified node pool with the requested node count limits.
To enable dynamic node scaling on an existing GKE Standard node pool, the `gcloud container node-pools update` command must be used with the `--enable-autoscaling` flag, specifying `--min-nodes` and `--max-nodes` parameters.

Step-by-Step Solution

1
Identify the scaling level required by the scenario
Pods are stuck in `Pending` due to insufficient node capacity, indicating that node-level scaling (Cluster Autoscaler) is needed rather than pod replica scaling (HPA).
Cluster Autoscaler adjusts the number of nodes in a node pool based on unschedulable pods.
2
Determine the appropriate tool and target resource for node pool configuration
GKE node pool properties are managed via the Google Cloud CLI using `gcloud container node-pools update`.
kubectl manages Kubernetes workload objects inside the cluster, whereas node infrastructure is managed via Google Cloud APIs.
3
Select the correct flag flags for node pool autoscaling
The flags `--enable-autoscaling`, `--min-nodes=2`, and `--max-nodes=10` explicitly configure the minimum and maximum node limits per zone for the node pool.
These flags tell Cluster Autoscaler the operational bounds within which it can automatically adjust compute resources.

Key Concept

Configuring GKE Cluster Autoscaler on Existing Node Pools
Rate this question