Soru

Zorluk: OrtaManaging Google Kubernetes Engine Resources

A DevOps engineer is managing a Google Kubernetes Engine (GKE) Standard cluster named `prod-app-cluster` in zone `us-central1-a`. During a traffic increase, several new microservice pods remain in a `Pending` state because the existing node pool, `frontend-pool`, lacks sufficient CPU resources to schedule them. The engineer needs to ensure that the GKE cluster automatically adds Compute Engine nodes to `frontend-pool` when pods are unschedulable due to resource constraints, up to a maximum of 10 nodes. Which command should the engineer run to achieve this requirement?

  1. gcloud container clusters update prod-app-cluster --enable-autoscaling --min-nodes=1 --max-nodes=10 --node-pool=frontend-pool --zone=us-central1-aCevap
  2. B
    kubectl autoscale deployment frontend-pool --min=1 --max=10 --cpu-percent=80
  3. C
    gcloud container clusters update prod-app-cluster --enable-autopilot --node-pool=frontend-pool --zone=us-central1-a
  4. D
    gcloud container node-pools update frontend-pool --cluster=prod-app-cluster --spot --zone=us-central1-a

Cevap

Execute the `gcloud container clusters update prod-app-cluster --enable-autoscaling --min-nodes=1 --max-nodes=10 --node-pool=frontend-pool --zone=us-central1-a` command.
Enabling Cluster Autoscaler on a node pool via `gcloud container clusters update prod-app-cluster --enable-autoscaling --min-nodes=1 --max-nodes=10 --node-pool=frontend-pool --zone=us-central1-a` instructs GKE to automatically resize the underlying Compute Engine instance group when pods cannot be scheduled due to insufficient CPU or memory resources.

Adım Adım Çözüm

1
Identify the root cause of the issue
Pods are stuck in `Pending` because the cluster nodes lack sufficient CPU resource requests to schedule the pods.
When nodes run out of capacity, Kubernetes cannot place pods until new node resources become available.
2
Select the appropriate scaling mechanism
Cluster Autoscaler must be enabled at the GKE cluster node pool level rather than Pod autoscaling (HPA).
Cluster Autoscaler increases or decreases the number of Compute Engine VM instances in a node pool based on unschedulable pods.
3
Formulate the correct gcloud CLI command
Use `gcloud container clusters update` specifying `--enable-autoscaling`, `--min-nodes`, `--max-nodes`, and targeting `--node-pool=frontend-pool`.
This updates the existing node pool configuration in the specified zone to dynamically scale nodes between 1 and 10.

Anahtar Kavram

Configuring GKE Cluster Autoscaler to dynamically scale Compute Engine node pools when pods are unschedulable.
Bu soruyu puanla