Question

Difficulty: MediumManaging Google Kubernetes Engine Resources

A cloud engineer needs to manually scale out an application deployment named `frontend-service` running in a Google Kubernetes Engine (GKE) cluster from 5 pod replicas to 20 pod replicas to handle an upcoming promotional event. The cluster already has sufficient node capacity to accommodate the additional workload. Which command should the engineer run to scale the application workload?

  1. kubectl scale deployment frontend-service --replicas=20Answer
  2. B
    gcloud container clusters resize production-cluster --node-pool=default-pool --num-nodes=20
  3. C
    gcloud container clusters update production-cluster --enable-autoscaling --min-nodes=5 --max-nodes=20
  4. D
    gcloud container node-pools update default-pool --cluster=production-cluster --replicas=20

Answer

Execute `kubectl scale deployment frontend-service --replicas=20` to update the application deployment workload replica count.
The `kubectl scale deployment` command updates the `spec.replicas` field of a Kubernetes Deployment. Because the GKE cluster already possesses adequate node compute capacity, increasing the pod count via `kubectl` immediately schedules the required additional replicas.

Step-by-Step Solution

1
Identify the target resource level to scale.
The target is an application Deployment (`frontend-service`), which is a Kubernetes workload object, rather than GKE VM node infrastructure.
Pod replica counts are managed at the workload layer using Kubernetes API tools.
2
Select the correct command-line interface and sub-command for scaling Kubernetes Deployments.
`kubectl scale deployment frontend-service --replicas=20` targets the deployment and updates its replica specification.
`kubectl` is used to manage Kubernetes resources, whereas `gcloud container` commands manage GCP GKE cluster and node pool infrastructure.

Key Concept

Scaling GKE Workloads vs. Scaling GKE Node Infrastructure
Estimated Time:1m 30s
Rate this question