A cloud engineer manages a GKE Standard cluster hosting stateless containerized microservices. During periodic traffic spikes, several newly created Pods remain in a 'Pending' state for extended periods because the current worker nodes lack sufficient available CPU capacity to fulfill the Pod resource requests. The engineer wants the cluster infrastructure to automatically provision additional Compute Engine Virtual Machine nodes whenever Pods cannot be scheduled due to resource constraints. Which action should the engineer take to resolve this issue?
- Enable Cluster Autoscaler on the GKE cluster using the command `gcloud container clusters update [CLUSTER_NAME] --enable-autoscaling --min-nodes=2 --max-nodes=10 --zone=[ZONE]`.Answer
- BDeploy a Horizontal Pod Autoscaler (HPA) using `kubectl autoscale deployment [DEPLOYMENT_NAME] --cpu-percent=80 --min=2 --max=10` to automatically provision additional Compute Engine nodes.
- CMigrate the workload to a GKE Autopilot cluster and configure custom Linux OS kernel tuning parameters on the node pool to force node provisioning during pending states.
- DCreate a static node pool consisting exclusively of Spot VMs with autoscaling disabled and apply Pod anti-affinity rules to force node expansion.
Answer
Enable Cluster Autoscaler on the GKE cluster using `gcloud container clusters update [CLUSTER_NAME] --enable-autoscaling --min-nodes=2 --max-nodes=10 --zone=[ZONE]`.
The correct action is to enable Cluster Autoscaler on the GKE cluster. Cluster Autoscaler monitors for Pods that cannot be scheduled due to insufficient CPU or memory resources on existing nodes and automatically adds Compute Engine VM instances to the node pool within the specified minimum and maximum bounds.
Step-by-Step Solution
Key Concept
GKE Cluster Autoscaler vs. Horizontal Pod Autoscaler operational management
Estimated Time:1m 30s