A DevOps team has provisioned a new regional Google Kubernetes Engine (GKE) cluster named `app-prod-cluster` in the `us-central1` region. A cloud engineer attempts to deploy an application manifest to the cluster by running `kubectl apply -f deployment.yaml` on their workstation, but receives the error: `The connection to the server localhost:8080 was refused`. Which command must the engineer execute to resolve this error?
- gcloud container clusters get-credentials app-prod-cluster --region us-central1Cevap
- Bgcloud config set container/cluster app-prod-cluster
- Cgcloud container clusters update app-prod-cluster --enable-autopilot --region us-central1
- Dgcloud iam service-accounts keys create key.json --iam-account [email protected]
Cevap
Execute `gcloud container clusters get-credentials app-prod-cluster --region us-central1` to retrieve the cluster's endpoint and authentication data into the local kubeconfig file.
Executing `gcloud container clusters get-credentials` retrieves the API endpoint and authentication credentials for the specified cluster and updates the local `~/.kube/config` configuration file. This allows `kubectl` to successfully discover and authenticate against the GKE control plane.
Adım Adım Çözüm
Anahtar Kavram
Configuring kubectl cluster context with gcloud container clusters get-credentials