You are using multiple configurations for gcloud. You want to review the configured Kubernetes Engine cluster of an inactive configuration using the fewest possible steps. What should you do?
A.
Use gcloud config configurations describe to review the output.
B.
Use gcloud config configurations activate and gcloud config list to review the output.
C.
Use kubectl config get-contexts to review the output.
D.
Use kubectl config use-context and kubectl config view to review the output.
C is correct , Use kubectl config get-contexts to review the output : shows the clusters and the configurations and based on the output we can identify the inactive configurations
This command enables you to view the settings, including cluster details, of the inactive configuration without activating it. This approach is the most efficient and concise method for inspection. Keep in mind that all kubectl commands will only display Kubernetes contexts after switching to them, not Google Cloud configurations. To improve your understanding of gcloud, you can activate the interactive help mode by using the command `gcloud beta interactive`.
A. As the kubectl just read you local .kubectl config file. the question was about gcloud configuration of a k8s cluster. As its not active must use describe.
This command shows the settings (including the cluster) of the inactive configuration without needing to activate it. This is the most efficient and minimal way to inspect it. All the kubectl commands will only show k8s contexts (once you switch to it) not the gcloud configurations . turn on gcloud interactive help mode - gcloud beta interative - this will help you learn gcloud
Why C and D are not ideal:
They assume that the inactive config already updated the kubectl context, which may not be true.
kubectl config get-contexts only shows kubeconfig contexts, not gcloud config clusters.
kubectl config use-context and kubectl config view affect your active kubeconfig, which can break workflows if misused.
They require the config to have been previously used and exported to kubeconfig (i.e., gcloud container clusters get-credentials must have been run).
Why A. gcloud config configurations describe is correct:
You don’t need to activate the configuration.
You see all the properties of the inactive config, including the container/cluster name and compute/zone (which together tell you what GKE cluster is being referenced).
Fastest, safest, and no side effects.
✅ Why A is Correct:
gcloud config configurations describe <CONFIG_NAME>
Allows you to inspect an inactive configuration without switching to it.
This provides the fewest steps because you don’t have to activate or switch context.
❌ Why the Others Are Wrong:
B. gcloud config configurations activate + gcloud config list
Not the fewest steps, requires activation first.
C. kubectl config get-contexts
Works only on active configuration, doesn’t inspect inactive gcloud configurations.
D. kubectl config use-context + kubectl config view
Also requires switching, which is more steps than simply describing.
kubectl get-contexts only reveals existing clusters and their names, it's not enough to reveal the configuration of the cluster. Therefore C is incorrect. D changes active cluster to the inactive, chosen one, and then reveals its configuration, as requested by the task.
In Kubernetes, "kubectl config get-contexts" is a command used to list all available contexts within your Kubernetes configuration, essentially showing you all the different cluster connections you can access, while "kubectl config use-context" allows you to switch to a specific context from that list, effectively changing which cluster you are currently interacting with; essentially letting you move between different Kubernetes environments using a single kubectl command line.
Key points about these commands:
kubectl config get-contexts:
Displays a list of all configured contexts, including their names and current status (whether they are the active context).
Useful to see which clusters you can connect to and which one is currently selected.
kubectl config use-context:
Allows you to switch to a specific context by providing its name as an argument.
Example: kubectl config use-context "my-cluster-context" would switch to the context named "my-cluster-context".
A. gcloud config configurations describe <inactive-config-name> will show the configured GKE cluster as value for property container/cluster ("Name of the cluster to use by default when working with Kubernetes Engine.")
B. more steps than A, so not "fewest possible steps"
C. and D. not necessarily specific to GKE and a named gcloud configuration
The answer is A. Use gcloud config configurations describe to review the output.
This command directly outputs the details of the specified configuration, including the
configured Kubernetes Engine cluster, without requiring you to activate the configuration or switch contexts.
Answer A: Using `gcloud config configurations described` will only show you the details of the current configuration, not the Kubernetes Engine cluster of an inactive configuration.
Answer B: Using `gcloud config configurations activate` and `gcloud config list` to review the output will only show you the list of configurations and activate one of them, but it won't provide you with the details of the Kubernetes Engine cluster of an inactive configuration.
Answer C: Using `kubectl config get-contexts` will only list the available contexts, including their clusters, but it won't provide you with the details of the Kubernetes Engine cluster of an inactive configuration.
This command allows you to see the contexts available in your kubeconfig file, including those associated with inactive configurations, without needing to activate any configuration. It provides a straightforward way to review the clusters and contexts without additional steps.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
zukko78
Highly Voted 5 years, 1 month agonhusain
4 years, 1 month agopoogcp
Highly Voted 5 years agoGurnoor
5 years agojilly
5 years agofracila
2 years, 7 months agoHismajesty
Most Recent 5 days, 22 hours agokewgard
1 month, 1 week agokewgard
1 month, 1 week agoMuhannadYW
1 month, 3 weeks agoMuhannadYW
1 month, 3 weeks agoZackandCoding
1 month, 3 weeks agotoasty
2 months, 1 week agoJoseph_Covaro
4 months, 4 weeks agoAKVT
5 months, 2 weeks agoAKVT
5 months, 2 weeks agoRoman1988
6 months, 1 week agouser263263
7 months, 2 weeks agoBagesh
8 months agodenno22
8 months, 4 weeks agoBuruguduystunstugudunstuy
9 months, 2 weeks agosivakarthick16
9 months, 2 weeks ago