A DevOps engineer is tasked with deploying an API gateway workload defined in `gateway-deployment.yaml` to an existing regional GKE cluster named `api-gateway-prod` located in the `europe-west1` region. When the engineer executes `kubectl apply -f gateway-deployment.yaml` from a freshly provisioned administration workstation, the operation fails with an authorization error because local kubeconfig parameters are missing. Which command must the engineer execute to generate the cluster authentication credentials and update the local kubeconfig context so `kubectl` can successfully interact with the cluster?
- gcloud container clusters get-credentials api-gateway-prod --region europe-west1Answer
- Bgcloud config set container/cluster api-gateway-prod
- Cgcloud container node-pools update default-pool --cluster api-gateway-prod --region europe-west1 --enable-autoupgrade
- Dkubectl config set-cluster api-gateway-prod --server=https://container.googleapis.com
Answer
The command 'gcloud container clusters get-credentials api-gateway-prod --region europe-west1' should be executed to fetch the API server credentials and update the local kubeconfig configuration.
The correct command utilizes the 'gcloud container clusters get-credentials' command with the appropriate cluster name and '--region' flag to download the necessary authentication credentials and API endpoint metadata directly into the user's local kubeconfig file, authorizing subsequent 'kubectl' commands.
Step-by-Step Solution
Key Concept
GKE Cluster Credential Retrieval and Kubeconfig Management
Estimated Time:2m 0s