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
Which command lists the GKE clusters in the current project?
- kubectl get clusters
- gcloud container clusters list
- gcloud compute clusters list
- 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.
Which approaches let a GKE cluster pull private images from Artifact Registry?
- Grant the Artifact Registry Reader role to the node service account
- Make sure the nodes have a storage read or cloud-platform access scope
- Reference a registry credential Secret in imagePullSecrets
- Grant the Reader role to the developer who runs kubectl
- 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.
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.
