Google Associate Cloud Engineer Question 111
Select 3Google Cloud PlatformYou are an Associate Cloud Engineer tasked with managing Kubernetes clusters on Google Kubernetes Engine (GKE). To interact with your GKE clusters, you need to install and configure kubectl on your local machine. Which of the following steps must you follow to correctly configure kubectl to manage a GKE cluster?
- A
Download and install the
kubectlbinary from the Kubernetes website. - B
Use
gcloud container clusters get-credentialsto configurekubectlto connect to your GKE cluster. - C
Grant necessary IAM permissions to your Google Cloud project to allow
kubectlaccess. - D
Set the Kubernetes context manually in the
kubeconfigfile. - E
Enable the Kubernetes Engine API in your Google Cloud project.
Show answer and explanation
Correct answers: A, B, E
Explanation
To manage GKE clusters using kubectl, you need to have kubectl installed, configure it using gcloud container clusters get-credentials, and ensure that the Kubernetes Engine API is enabled in your Google Cloud project. This setup ensures that kubectl can authenticate with and manage your GKE clusters effectively. While IAM permissions are required for API access, they are not part of the local kubectl setup process.
- A. Correct.
Downloading and installing the
kubectlbinary is necessary to use it for managing Kubernetes clusters. - B. Correct.
Using
gcloud container clusters get-credentialsis the recommended way to configurekubectlfor GKE clusters, as it sets up the necessary authentication and configures thekubeconfigfile automatically. - C. Incorrect.
While IAM permissions are important, this step is not directly related to the installation or initial configuration of
kubectlitself. - D. Incorrect.
Setting the Kubernetes context manually is unnecessary when using GKE, as
gcloud container clusters get-credentialshandles context configuration. - E. Correct.
Enabling the Kubernetes Engine API is crucial for managing Kubernetes clusters on GCP, as it allows you to interact with the GKE service.