A cloud administrator recently created a new Google Kubernetes Engine (GKE) cluster named `analytics-cluster` in the `us-east1` region. When attempting to run `kubectl get pods` from their local workstation terminal, the command fails because `kubectl` is not configured to communicate with the cluster. Which command must the administrator execute to fetch the cluster credentials and automatically update their local `kubeconfig` file?
- gcloud container clusters get-credentials analytics-cluster --region us-east1Cevap
- Bgcloud config set container/cluster analytics-cluster
- Cgcloud container clusters create analytics-cluster --enable-autopilot --region us-east1
- Dgcloud compute instances create analytics-node --spot
Cevap
The command 'gcloud container clusters get-credentials analytics-cluster --region us-east1' is correct because it populates the local kubeconfig file with the necessary API endpoint and authentication credentials required by kubectl.
Executing 'gcloud container clusters get-credentials' retrieves the API endpoint and authentication tokens for the cluster and updates the local kubeconfig configuration file, allowing kubectl commands to succeed.
Adım Adım Çözüm
Anahtar Kavram
Fetching GKE cluster credentials for kubectl management
Tahmini Süre:45s