Google Cloud CLI (gcloud) cheatsheet

Google Cloud CLI (gcloud): Kubernetes and IAM

5 common Google Cloud CLI (gcloud) tasks.

Connect kubectl to GKE

Add a cluster's credentials to your kubeconfig.

gcloud container clusters get-credentials my-cluster --region us-central1

List GKE clusters

Show the Kubernetes clusters in the project.

gcloud container clusters list

List service accounts

Show the service accounts in the project.

gcloud iam service-accounts list

Grant a role

Give a user a role on the project.

gcloud projects add-iam-policy-binding my-project --member user:[email protected] --role roles/viewer

Authenticate Docker to Artifact Registry

Let Docker push and pull images from a registry host.

gcloud auth configure-docker us-docker.pkg.dev

Was this page helpful?