ASSOCIATE-CLOUD-ENGINEER practice question 26 of 35

You are assigned to maintain a Google Kubernetes Engine (GKE) cluster named dev that was deployed on Google Cloud. You want to manage the GKE configuration using the command line interface (CLI). You have just downloaded and installed the Cloud SDK. You want to ensure that future CLI commands by default address this specific cluster. What should you do?

Full set: 332 questions
Answer options
A: Use the command gcloud config set container/cluster dev. Correct answer
B: Use the command gcloud container clusters update dev.
C: Create a file called gke.default in the ~/.gcloud aname.
D: Create a file called defaults.json in the ~/.gcloud folder that contains the cluster name.
Correct Answer:
A. Use the command gcloud config set container/cluster dev.
Explanation

The gcloud config set command is the standard method for setting properties in the active Cloud SDK configuration. To set a default value for a specific service, you use the format [group]/[property]. For Google Kubernetes Engine, the group is container and the property for the cluster name is cluster. Therefore, gcloud config set container/cluster dev correctly configures the CLI to use the 'dev' cluster for all subsequent gcloud container commands, eliminating the need to specify the --cluster flag each time.

Why Incorrect

B. The gcloud container clusters update command modifies the configuration of the GKE cluster resource on Google Cloud, not the local client-side CLI settings.
C. Manually creating a file named gke.default is not a recognized method for configuring the Cloud SDK. Configuration is managed via gcloud config commands.
D. Manually creating a defaults.json file is not the correct procedure for setting Cloud SDK properties. The CLI uses a structured configuration file managed by gcloud commands.

References

1. Google Cloud SDK Documentation

gcloud config set: "The gcloud config set command sets a property in your gcloud CLI configuration... For example

to set the default zone to us-central1-a

run: gcloud config set compute/zone us-central1-a". This demonstrates the command's usage and format. The same principle applies to container/cluster.

Source: Google Cloud. (n.d.). gcloud config set. Google Cloud SDK Documentation. Retrieved from https://cloud.google.com/sdk/gcloud/reference/config/set

2. Google Cloud SDK Documentation

Available Properties: The official documentation lists all available properties that can be set. Under the "container" section

the cluster property is defined as "The default cluster to use for container commands."

Source: Google Cloud. (n.d.). gcloud topic configurations. Google Cloud SDK Documentation. See the section on "Available Properties". Retrieved from https://cloud.google.com/sdk/gcloud/reference/topic/configurations

3. Google Kubernetes Engine Documentation

gcloud container: The documentation for the gcloud container command group implicitly relies on these configuration settings. For example

in the usage for gcloud container clusters describe [CLUSTERNAME]

it notes that flags like --zone can be omitted if the compute/zone property is set. This same logic applies to the container/cluster property for other commands.

Source: Google Cloud. (n.d.). gcloud container. Google Cloud SDK Documentation. Retrieved from https://cloud.google.com/sdk/gcloud/reference/container

Scroll to Top