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?
- gcloud container clusters get-credentials analytics-prod-cluster --region us-east1Cevap
- Bgcloud config set container/cluster analytics-prod-cluster --region us-east1
- Cgcloud container clusters update analytics-prod-cluster --enable-autopilot --region us-east1
- Dgcloud 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
Anahtar Kavram
Fetching GKE cluster credentials to configure local kubectl context