Part 1 — Foundations · wrap-up
Cheat sheet & self-check
Every command from this section on one page.
Find your way around
gcloud config list | Active account, project and default region/zone |
gcloud config set project my-prod-project | Switch the project every later command uses |
gcloud projects list | Projects you can see |
gcloud services list --enabled | APIs enabled in the project (container.googleapis.com for GKE) |
gcloud services enable container.googleapis.com artifactregistry.googleapis.com | Enable the GKE and Artifact Registry APIs |
GKE at a glance
gcloud container clusters list | Clusters in the project, with location, version and status |
gcloud container get-server-config --region europe-west1 | Versions available per release channel in a region |
gcloud container clusters get-credentials prod --region europe-west1 | Write a kubeconfig entry (uses gke-gcloud-auth-plugin) |
gcloud container node-pools list --cluster prod --region europe-west1 | Node pools of a Standard cluster |
Create (lab)
gcloud container clusters create-auto lab --region europe-west1 | An Autopilot cluster: regional, release channel Regular by default |
gcloud container clusters create lab --region europe-west1 --release-channel regular --num-nodes 1 | A Standard regional cluster: 1 node per zone (3 in total) |
gcloud container clusters create lab-z --zone europe-west1-b --num-nodes 2 | A zonal Standard cluster (cheaper, no control-plane redundancy) |
Inspect
gcloud container clusters describe lab --region europe-west1 --format='value(autopilot.enabled,releaseChannel.channel,currentMasterVersion)' | Mode, channel and control-plane version |
gcloud container get-server-config --region europe-west1 --flatten=channels --format='table(channels.channel,channels.defaultVersion)' | Default version per release channel |
kubectl get nodes -L topology.kubernetes.io/zone | Nodes and the zones they run in |