Question

Difficulty: MediumDeploying and Managing Google Kubernetes Engine (GKE) Clusters and Workloads

A DevOps team operates a high-traffic web application on Google Kubernetes Engine (GKE). During traffic bursts, CPU utilization across application pods increases significantly beyond target thresholds. Additionally, during peak events, scaling up pod instances causes newly created pods to remain in a Pending state because current cluster nodes lack available CPU and memory resources. The team needs to implement an automated scaling architecture to handle both pod-level CPU load spikes and node-level resource shortages. Which scaling configuration should they implement?

  1. Configure a Horizontal Pod Autoscaler (HPA) to dynamically adjust pod replica count based on CPU utilization, and enable Cluster Autoscaler to automatically add nodes when pods are unschedulable.Answer
  2. B
    Configure Cluster Autoscaler to increase pod replica count based on CPU metrics, and enable Vertical Pod Autoscaler (VPA) to provision additional GKE compute nodes when pods enter a Pending state.
  3. C
    Migrate the application workloads to GKE Autopilot using fixed static node pools, relying on static node limits to manage pod CPU spikes without changing cluster size.
  4. D
    Provision a Spot VM node pool with pod preemption policies to terminate and replace pending pods whenever node CPU utilization exceeds target thresholds.

Answer

Configure a Horizontal Pod Autoscaler (HPA) to scale pod replicas based on CPU metrics, and enable Cluster Autoscaler to automatically add GKE nodes when pending pods cannot be scheduled.
The correct approach combines Horizontal Pod Autoscaler (HPA) and Cluster Autoscaler. HPA scales the number of running pod instances in a Deployment based on metric thresholds like CPU usage. When HPA creates additional pods that exceed total available node memory or CPU, GKE marks those pods as Pending. Cluster Autoscaler detects these pending unschedulable pods and provisions new GKE node instances in the node pool to accommodate them.

Step-by-Step Solution

1
Identify the pod-level scaling requirement.
Recognize that CPU load spikes on existing containers require dynamically adjusting pod replica count.
Horizontal Pod Autoscaler (HPA) monitors pod metrics like CPU utilization and automatically increases or decreases pod replica count in response.
2
Identify the cluster-level scaling requirement.
Recognize that pods remaining in a Pending state due to insufficient cluster compute resources require node-level expansion.
Cluster Autoscaler detects unschedulable pods waiting for compute capacity and resizes GKE node pools by adding new virtual machine instances.
3
Combine the two autoscaling mechanisms for end-to-end elasticity.
Deploying HPA alongside Cluster Autoscaler ensures pods scale out during load increases, and nodes scale out whenever newly created pods exceed current cluster capacity.
HPA and Cluster Autoscaler operate at distinct operational layers in GKE to provide complete autoscaling capabilities.

Key Concept

GKE Workload and Node Autoscaling Architecture
Estimated Time:1m 30s
Rate this question