Medium1 markMultiple Choice

GCP ACE · Question 22 · Domain 3.2: Deploying and implementing GKE resources

You have created a new Google Kubernetes Engine (GKE) cluster. You need to configure your local kubectl command-line tool to communicate with this cluster. Which command should you run?

Answer options:

A.

kubectl config set-cluster [CLUSTER_NAME]

B.

gcloud container clusters get-credentials [CLUSTER_NAME]

C.

gcloud compute clusters connect [CLUSTER_NAME]

D.

kubectl auth login [CLUSTER_NAME]

How to approach this question

Remember the gcloud command used to fetch GKE credentials.

Full Answer

B.gcloud container clusters get-credentials [CLUSTER_NAME]✓ Correct
gcloud container clusters get-credentials [CLUSTER_NAME]
To interact with a GKE cluster using `kubectl`, you must first populate your local `~/.kube/config` file with the cluster's endpoint and authentication data. The `gcloud container clusters get-credentials` command does this automatically.

Common mistakes

Trying to use raw `kubectl` commands to set up authentication, which is complex and bypasses GCP's IAM integration.

Practice the full GCP Associate Cloud Engineer Practice Exam 1

50 questions · hints · full answers · grading

More questions from this exam