Andrew Mercer
on this page
  • https://cloud.google.com/kubernetes-engine/docs/deploy-app-cluster

Prerequisites

gcloud auth login
gcloud config set project <project-id>
gcloud services enable container.googleapis.com
gcloud components install gke-gcloud-auth-plugin

kubectl needs gke-gcloud-auth-plugin to authenticate to GKE.

Variables

CLUSTER=gke-lab
ZONE=northamerica-northeast2-a
REGION=northamerica-northeast2

Option 1: Standard cluster (you manage nodes)

A zonal cluster with a small node pool:

gcloud container clusters create $CLUSTER \
  --zone $ZONE \
  --num-nodes 2 \
  --machine-type e2-standard-2 \
  --release-channel regular

Option 2: Autopilot cluster (Google manages nodes)

Autopilot clusters are always regional. You pay per pod resource request rather than per node:

gcloud container clusters create-auto $CLUSTER --region $REGION

Connect

gcloud container clusters get-credentials $CLUSTER --zone $ZONE     # Standard
gcloud container clusters get-credentials $CLUSTER --region $REGION # Autopilot
kubectl get nodes

Clean up

gcloud container clusters delete $CLUSTER --zone $ZONE     # or --region $REGION