An infrastructure engineer needs to grant local administrative tools access to a newly created Google Kubernetes Engine (GKE) cluster named `analytics-prod` located in the `us-central1` region. When attempting to execute `kubectl get nodes`, the command fails with a connection refused error because local context credentials are missing. Which command should the engineer run to populate kubeconfig with the required cluster credentials?
- gcloud container clusters get-credentials analytics-prod --region us-central1Answer
- Bkubectl config set-cluster analytics-prod --server=https://us-central1-gke.cloud.google.com
- Cgcloud container node-pools update analytics-prod --enable-autoscaling --region us-central1
- Dgcloud container clusters update analytics-prod --enable-autopilot --region us-central1
Answer
The command `gcloud container clusters get-credentials analytics-prod --region us-central1` updates the local kubeconfig file with endpoint details and authentication credentials required by kubectl.
Executing `gcloud container clusters get-credentials analytics-prod --region us-central1` automatically downloads the endpoint information and authentication token helper for the specified cluster, appending or updating the context in the local `kubeconfig` file.
Step-by-Step Solution
Key Concept
Configuring kubectl credentials for GKE cluster management using gcloud CLI.
Estimated Time:1m 30s