Activate service account
Auth as SA in CI; note: prefer workload identity over long-lived key files
gcloud auth activate-service-account --key-file=key.json && gcloud config set project <id>
- tool
- gcloud8 commands
More gcloud commands
-
gcloud container clusters get-credentials <cluster> --region <id> --project <id>Fetch GKE kubeconfig; modern: needs gke-gcloud-auth-plugin in PATH since k8s 1.26
-
gcloud compute instances list --format="table(name,status,EXTERNAL_IP)" --filter="status=RUNNING"Custom table of running VMs and public IPs via --format/--filter projections
-
gcloud projects get-iam-policy <id> --flatten="bindings[].members" --format="table(bindings.role,bindings.members)"Audit who has which role; --flatten explodes nested bindings into rows
-
gcloud logging read 'severity>=ERROR' --limit 20 --freshness=1h --format='value(timestamp,resource.type,textPayload)'Pull last hour of errors across project; --freshness avoids full scan
-
gcloud compute ssh <name> --zone <id> --tunnel-through-iapReach a VM with no public IP through Identity-Aware Proxy; no bastion needed