Google Associate Cloud Engineer Question 190
Single answerGoogle Cloud PlatformYou are managing a Google Kubernetes Engine (GKE) cluster and need to view the current inventory of running clusters in your Google Cloud Platform project. Which command should you use to list all the running GKE clusters in your project?
- A
gcloud container clusters list
- B
kubectl get clusters
- C
gcloud compute instances list
- D
gcloud container clusters describe
Show answer and explanation
Correct answer: A
Explanation
To view the current inventory of running GKE clusters in a Google Cloud Platform project, the 'gcloud container clusters list' command is used. This command provides an overview of all existing clusters, including their status and configuration details. It is the appropriate command for listing clusters, while other commands are either incorrect or serve different purposes.
- A. Correct.
This command lists all the running GKE clusters in the specified project, providing their names, locations, and other details.
- B. Incorrect.
This command is incorrect as 'kubectl get clusters' is not a valid command in Kubernetes. 'kubectl' is used for managing resources within a specific cluster, not for listing clusters themselves.
- C. Incorrect.
This command lists all the Compute Engine instances, not GKE clusters. It is used for VM instances rather than Kubernetes resources.
- D. Incorrect.
This command is used to describe a specific GKE cluster, not to list all clusters. It provides details of a single cluster rather than an inventory of all clusters.