A developer has created a Google Kubernetes Engine (GKE) cluster to host an application. Before running `kubectl` commands to manage workloads on the cluster, the developer must retrieve cluster access credentials and configure the local command-line environment. Which `gcloud` command should the developer run to update the local `kubeconfig` file with these credentials?
- gcloud container clusters get-credentials my-cluster --zone us-central1-aCevap
- Bgcloud config set container/cluster my-cluster
- Cgcloud container node-pools describe my-cluster --zone us-central1-a
- Dgcloud compute instances describe my-cluster-node --zone us-central1-a
Cevap
Execute `gcloud container clusters get-credentials my-cluster --zone us-central1-a` to automatically populate the local kubeconfig file with cluster endpoints and security credentials.
Executing `gcloud container clusters get-credentials` authenticates against the specified GKE cluster and writes the required certificate authority data, cluster endpoint, and user token into the local `kubeconfig` file. This establishes the active context needed for `kubectl` to communicate with the cluster API server.
Adım Adım Çözüm
Anahtar Kavram
Configuring local kubectl context using gcloud container clusters get-credentials