Question

Difficulty: EasyManaging Google Kubernetes Engine Resources

An administrator needs to configure automatic scaling for a Google Kubernetes Engine (GKE) Deployment so that the number of Pod replicas increases or decreases based on CPU utilization. Which command should the administrator execute to achieve this?

  1. kubectl autoscale deployment web-app --min=2 --max=10 --cpu-percent=80Answer
  2. B
    gcloud container clusters update my-cluster --enable-autoscaling --min-nodes=2 --max-nodes=10
  3. C
    gcloud container node-pools update my-pool --enable-autopilot --min-pods=2 --max-pods=10
  4. D
    kubectl scale deployment web-app --replicas=10 --spot

Answer

The correct command is `kubectl autoscale deployment web-app --min=2 --max=10 --cpu-percent=80`.
Executing `kubectl autoscale deployment` creates a Horizontal Pod Autoscaler (HPA) resource in GKE that automatically increases or decreases the number of Pod replicas in response to CPU utilization metrics.

Step-by-Step Solution

1
Identify the resource tier that requires scaling.
The requirement specifies scaling Pod replicas inside a Deployment based on workload metric demand, not compute nodes.
Horizontal Pod Autoscaler (HPA) operates at the Kubernetes workload abstraction level.
2
Select the appropriate CLI tool and command syntax for HPA creation.
Using `kubectl autoscale deployment` creates an HPA object targeting the deployment with min/max replica boundaries and a target CPU percentage.
`kubectl autoscale` directly provisions the HPA controller resource in GKE.

Key Concept

Horizontal Pod Autoscaling (HPA) in Google Kubernetes Engine
Rate this question