An administrator needs to configure a local management workstation to interact with a newly created Google Kubernetes Engine (GKE) cluster named `finance-app-cluster` in the `us-central1-a` zone. Which of the following commands are required to fetch the cluster credentials for `kubectl` and verify the running workloads? (Select TWO.)
- Execute `gcloud container clusters get-credentials finance-app-cluster --zone us-central1-a` to update the local kubeconfig file.Answer
- BExecute `gcloud config set container/cluster finance-app-cluster` to establish the kubectl authentication context.
- Execute `kubectl get pods` to list the currently running Kubernetes workload pods in the cluster.Answer
- DExecute `gcloud compute instances list --cluster finance-app-cluster` to establish direct API credentials for kubectl.
Answer
The correct commands are executing `gcloud container clusters get-credentials finance-app-cluster --zone us-central1-a` to populate the local kubeconfig file and executing `kubectl get pods` to inspect the workload pods.
To manage a GKE cluster via kubectl, credentials must first be fetched using `gcloud container clusters get-credentials`, specifying the cluster name and location (zone or region). Once configured, standard Kubernetes tools like `kubectl get pods` interact directly with the cluster API server.
Step-by-Step Solution
Key Concept
Deploying and Managing GKE Clusters and Workloads - Authenticating kubectl and querying GKE resources