Soru

Zorluk: OrtaDeploying and Managing Google Kubernetes Engine (GKE) Clusters and Workloads

A cloud administrator creates a new regional Google Kubernetes Engine (GKE) cluster named `analytics-prod-cluster` in the `us-east1` region. The administrator opens a local terminal on a workstation where the `gcloud` CLI is installed and authenticated with proper Cloud IAM permissions. However, when executing `kubectl get nodes`, the terminal returns an error stating that the cluster context cannot be found. Which command should the administrator execute to populate the local `kubeconfig` file with the cluster credentials?

  1. gcloud container clusters get-credentials analytics-prod-cluster --region us-east1Cevap
  2. B
    gcloud config set container/cluster analytics-prod-cluster --region us-east1
  3. C
    gcloud container clusters update analytics-prod-cluster --enable-autopilot --region us-east1
  4. D
    gcloud container node-pools create analytics-prod-cluster-pool --cluster analytics-prod-cluster --spot

Cevap

The administrator must execute `gcloud container clusters get-credentials analytics-prod-cluster --region us-east1` to update the local `kubeconfig` file.
Executing `gcloud container clusters get-credentials analytics-prod-cluster --region us-east1` retrieves the cluster's endpoint information and credentials from Google Cloud, automatically generating or updating the local `kubeconfig` file. This establishes the active context for `kubectl` to issue commands to the cluster control plane.

Adım Adım Çözüm

1
Identify the requirement to configure kubectl to communicate with a newly provisioned regional GKE cluster.
Recognize that kubectl requires cluster endpoints and security credentials stored in the local ~/.kube/config file.
Creating a cluster on Google Cloud does not automatically update local workstation context configurations.
2
Select the appropriate gcloud command to download the cluster credentials.
Specify `gcloud container clusters get-credentials` along with the cluster name (`analytics-prod-cluster`) and the region parameter (`--region us-east1`).
This command fetches endpoint details, generates an access token, and sets the active context in the local kubeconfig file.

Anahtar Kavram

Fetching GKE cluster credentials to configure local kubectl context
Bu soruyu puanla