Google Cloud Associate Cloud Engineer — Question 204
You used the gcloud container clusters command to create two Google Cloud Kubernetes (GKE) clusters: prod-cluster and dev-cluster.
• prod-cluster is a standard cluster.
• dev-cluster is an auto-pilot cluster.
When you run the kubectl get nodes command, you only see the nodes from prod-cluster. Which commands should you run to check the node status for dev-cluster?
Answer options
- A. gcloud container clusters get-credentials dev-cluster kubectl get nodes
- B. gcloud container clusters update -generate-password dev-cluster kubectl get nodes
- C. kubectl config set-context dev-cluster kubectl cluster-info
- D. kubectl config set-credentials dev-cluster kubectl cluster-info
Correct answer: A
Explanation
The correct answer is A because running 'gcloud container clusters get-credentials dev-cluster' configures kubectl to use the credentials for the dev-cluster, allowing you to see its nodes with the subsequent 'kubectl get nodes' command. The other options do not correctly set the context or credentials needed to access the dev-cluster's nodes.