You created two GKE clusters, prod-cluster (standard) and dev-cluster (autopilot). kubectl get nodes only shows nodes from prod-cluster. Which commands will load dev-cluster credentials and show its nodes?
Choose an answer
Tap an option to check your answer.
Correct answer: gcloud container clusters get-credentials dev-cluster kubectl get nodes.
Why this is the answer
The correct command is gcloud container clusters get-credentials dev-cluster. This command fetches the credentials for dev-cluster and configures kubectl to use them, making dev-cluster the current context. After this, kubectl get nodes will correctly display the nodes for dev-cluster. The other options are incorrect: gcloud container clusters update -generate-password dev-cluster is used to update cluster settings, not to get credentials or switch contexts. kubectl config set-context dev-cluster would attempt to set a context named dev-cluster but wouldn't fetch the necessary credentials, and kubectl cluster-info only shows information about the current cluster, not its nodes. kubectl config set-credentials dev-cluster is used to define user credentials, not to retrieve cluster credentials or switch the active context.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed