Bitzu

Associate Cloud Engineer ยท Operating GKE clusters

How do you inspect a GKE cluster and let it pull from Artifact Registry?

kubectl get nodes/pods/services, kubectl describe, gcloud container clusters list, letting a cluster pull from Artifact Registry (node service account roles, imagePullSecrets).

Key points

  • gcloud container clusters list shows clusters in a project.
  • After connecting, kubectl get nodes/pods/services lists objects and kubectl describe shows details and events.
  • Nodes pull private images using the node service account, so it needs roles/artifactregistry.reader (and storage read scope); imagePullSecrets are the alternative.

Source: https://docs.cloud.google.com/artifact-registry/docs/access-control

Practice questions

Single choice

Which command lists the GKE clusters in the current project?

  1. kubectl get clusters
  2. gcloud container clusters list
  3. gcloud compute clusters list
  4. kubectl cluster list --all
Show answer

Answer: B. gcloud container clusters list

gcloud container clusters list queries the GKE API. kubectl only talks to a cluster you are already connected to and has no 'clusters' resource.

Select all that apply

Which approaches let a GKE cluster pull private images from Artifact Registry?

  1. Grant the Artifact Registry Reader role to the node service account
  2. Make sure the nodes have a storage read or cloud-platform access scope
  3. Reference a registry credential Secret in imagePullSecrets
  4. Grant the Reader role to the developer who runs kubectl
  5. Enable the Cloud Build API in the project
Show answer

Answer: A. Grant the Artifact Registry Reader role to the node service account, B. Make sure the nodes have a storage read or cloud-platform access scope, C. Reference a registry credential Secret in imagePullSecrets

Either the node identity has read access (role plus a storage-read or cloud-platform scope) or Pods carry registry credentials through imagePullSecrets. Roles on a human user and enabling an unrelated API do not affect pulls.

True or false

Running gcloud container clusters list also shows the Pods running inside each cluster.

Show answer

Answer: False

False. It lists clusters only. Pods are Kubernetes objects, listed with kubectl get pods after connecting to a cluster.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More Associate Cloud Engineer topics in this module