A cloud engineer attempts to deploy an updated Kubernetes Deployment manifest to an existing GKE cluster named `inventory-cluster` in zone `us-central1-a` by running `kubectl apply -f deployment.yaml`. The command fails with an error stating `The connection to the server localhost:8080 was refused`, indicating that local command-line tools are not configured to communicate with the GKE control plane. Which command should the engineer execute to correctly fetch cluster credentials and configure the local `kubeconfig` context?
- gcloud container clusters get-credentials inventory-cluster --zone us-central1-aCevap
- Bgcloud config set container/cluster inventory-cluster
- Cgcloud container clusters update inventory-cluster --enable-autoscaling --min-nodes 1 --max-nodes 5 --zone us-central1-a
- Dgcloud container node-pools create spot-pool --cluster inventory-cluster --spot --zone us-central1-a
Cevap
The cloud engineer should execute `gcloud container clusters get-credentials inventory-cluster --zone us-central1-a` to populate the local kubeconfig context with the cluster endpoint and credentials.
Running `gcloud container clusters get-credentials` retrieves authentication credentials and cluster endpoint details from Google Kubernetes Engine and writes them to the local `kubeconfig` configuration file, allowing `kubectl` to successfully communicate with the control plane.
Adım Adım Çözüm
Anahtar Kavram
Fetching GKE cluster credentials to configure local kubectl context