gcloud container clusters create: Provision GKE
gcloud container clusters create provisions a Google Kubernetes Engine cluster, standard or Autopilot.
Spinning up GKE for an integration test or a fresh environment starts here. Choose Autopilot for hands-off node management or standard for explicit node pools.
What it does
gcloud container clusters create creates a GKE control plane and (in standard mode) an initial node pool with the machine type and node count you specify. Autopilot mode manages nodes for you.
Common usage
gcloud container clusters create ci-cluster \
--region=us-central1 --num-nodes=2 \
--machine-type=e2-standard-4 --release-channel=regular
# Autopilot
gcloud container clusters create-auto ci-cluster \
--region=us-central1Flags
| Flag | What it does |
|---|---|
| --region / --zone | Regional or zonal cluster placement |
| --num-nodes <n> | Nodes per zone in the default pool (standard) |
| --machine-type <type> | Node machine type |
| --release-channel <chan> | rapid, regular, or stable channel |
| --workload-pool <pool> | Enable Workload Identity for the cluster |
| --enable-private-nodes | Create a private cluster |
In CI
Add --workload-pool=PROJECT_ID.svc.id.goog so pods can use Workload Identity instead of node service-account keys. Cluster creation can take several minutes, so set a generous job timeout, then run gcloud container clusters get-credentials to populate kubeconfig.
Common errors in CI
"Quota 'CPUS' exceeded" or "Insufficient regional quota" means not enough vCPUs in the region; lower --num-nodes or change region. "ResponseError: code=400 ... master version unsupported" means a pinned --cluster-version is no longer offered on that channel. "Required 'container.clusters.create' permission" means the account lacks roles/container.admin.