You have created a Google Kubernetes Engine (GKE) cluster named `demo-cluster` in zone `us-central1-a`. You open a terminal and run `kubectl get nodes`, but the command fails because your local authentication context is missing. Which `gcloud` command must you execute to update your kubeconfig file with credentials for this cluster?
- gcloud container clusters get-credentials demo-cluster --zone us-central1-aAnswer
- Bgcloud config set container/cluster demo-cluster
- Cgcloud container node-pools list --cluster demo-cluster --zone us-central1-a
- Dgcloud compute instances list --zone us-central1-a
Answer
Execute `gcloud container clusters get-credentials demo-cluster --zone us-central1-a` to update the local kubeconfig context.
Executing `gcloud container clusters get-credentials demo-cluster --zone us-central1-a` downloads cluster credentials and updates the local `kubeconfig` file, allowing `kubectl` to interact with the GKE cluster.
Step-by-Step Solution
Key Concept
Fetching GKE cluster credentials using gcloud to configure local kubectl context
Estimated Time:45s