Soru

Zorluk: OrtaManaging Google Kubernetes Engine Resources

A cloud engineer manages a Google Kubernetes Engine (GKE) Standard cluster named `analytics-cluster` in zone `us-central1-a`. Several newly deployed workload Pods are stuck in a `Pending` state because the existing node pool named `analytics-pool` lacks sufficient CPU capacity to schedule them. The engineer needs to ensure that worker node capacity automatically scales out whenever Pods cannot be scheduled due to resource constraints. Which `gcloud` command should the engineer execute?

  1. gcloud container clusters update analytics-cluster --enable-autoscaling --node-pool=analytics-pool --min-nodes=2 --max-nodes=8 --zone=us-central1-aCevap
  2. B
    kubectl autoscale deployment analytics-worker --min=2 --max=8 --cpu-percent=80
  3. C
    gcloud container node-pools update analytics-pool --cluster=analytics-cluster --enable-spot --zone=us-central1-a
  4. D
    gcloud container clusters update analytics-cluster --enable-autoprovisioning --zone=us-central1-a

Cevap

Execute `gcloud container clusters update analytics-cluster --enable-autoscaling --node-pool=analytics-pool --min-nodes=2 --max-nodes=8 --zone=us-central1-a` to enable Cluster Autoscaler on the existing node pool.
The correct command updates the GKE cluster configuration by enabling Cluster Autoscaler specifically for the target node pool (`analytics-pool`) with defined minimum and maximum node limits. When Pods cannot be scheduled due to insufficient CPU, Cluster Autoscaler provisions additional Compute Engine nodes in the pool.

Adım Adım Çözüm

1
Identify the resource bottleneck preventing Pod scheduling
Pods are in a `Pending` state due to insufficient CPU capacity on existing worker nodes.
When nodes run out of schedulable CPU or memory requests, Kubernetes cannot place incoming Pods on current nodes.
2
Select the appropriate scaling component
Choose Cluster Autoscaler rather than Horizontal Pod Autoscaler.
Cluster Autoscaler manages the infrastructure layer (Compute Engine instances in the node pool), whereas HPA manages Pod replica counts.
3
Execute the node pool autoscaling command
Run `gcloud container clusters update` specifying `--enable-autoscaling`, `--node-pool`, `--min-nodes`, and `--max-nodes`.
This enables GKE Cluster Autoscaler to automatically provision additional Compute Engine instances within the specified boundaries when pending Pods are detected.

Anahtar Kavram

GKE Cluster Autoscaler configuration for dynamic node pool scaling
Bu soruyu puanla