Creating a GKE cluster involves choosing a cluster mode, configuring networking, selecting machine types, and enabling features. This page walks through the prerequisites and step-by-step creation using gcloud and the Google Cloud Console.

Prerequisites

Before creating a cluster, ensure you have:

RequirementCommand / Action
Google Cloud projectgcloud projects create PROJECT_ID
Billing enabledLink a billing account in the Console
Kubernetes Engine API enabledgcloud services enable container.googleapis.com
gcloud CLI installedInstall gcloud CLI
kubectl installedgcloud components install kubectl
Authenticated gcloudgcloud auth login
# Set your project
gcloud config set project PROJECT_ID
 
# Set default compute zone/region
gcloud config set compute/zone ZONE   # e.g., us-central1-a

Quick Create

The fastest way to get a running cluster:

# Autopilot cluster (recommended for most workloads)
gcloud container clusters create-auto my-cluster \
  --region=us-central1
 
# Standard cluster (when you need node-level control)
gcloud container clusters create my-cluster \
  --zone=us-central1-a \
  --num-nodes=3

Tip: create-auto creates an Autopilot cluster. create creates a Standard cluster. The commands are different — do not confuse them.

Cluster Creation Flow

flowchart TD
    A[Choose Cluster Mode] --> B{Autopilot or Standard?}
    B -->|Autopilot| C["gcloud container clusters create-auto"]
    B -->|Standard| D["gcloud container clusters create"]
    C --> E[Configure region & networking]
    D --> F[Configure zone/region, machine type, node count]
    E --> G[Enable features]
    F --> G
    G --> H[Create cluster]
    H --> I[Get credentials]
    I --> J[Deploy workloads]

Autopilot Cluster — Full Example

gcloud container clusters create-auto my-autopilot-cluster \
  --region=us-central1 \
  --network=my-vpc \
  --subnetwork=my-subnet \
  --enable-private-nodes \
  --master-authorized-networks=10.0.0.0/8 \
  --release-channel=regular \
  --workload-pool=PROJECT_ID.svc.id.goog

Key Autopilot Flags

FlagPurposeDefault
--regionRegion for the cluster (required)Prompted
--networkVPC networkdefault
--subnetworkSubnet within the VPCAuto
--enable-private-nodesNodes have no public IPsDisabled
--master-authorized-networksCIDR ranges that can access the control planeOpen (0.0.0.0/0)
--release-channelUpgrade cadence: rapid, regular, stableregular
--workload-poolEnable Workload Identity Federation for GKEDisabled

Note: Autopilot clusters do not accept --machine-type or --num-nodes flags. Google manages nodes automatically based on your pod resource requests.

Standard Cluster — Full Example

gcloud container clusters create my-standard-cluster \
  --zone=us-central1-a \
  --machine-type=e2-medium \
  --num-nodes=3 \
  --disk-size=50GB \
  --disk-type=pd-ssd \
  --enable-autoupgrade \
  --enable-autorepair \
  --max-surge-upgrade=1 \
  --max-unavailable-upgrade=0 \
  --network=my-vpc \
  --subnetwork=my-subnet \
  --enable-ip-alias \
  --cluster-ipv4-cidr=/21 \
  --services-ipv4-cidr=/24 \
  --release-channel=regular \
  --workload-pool=PROJECT_ID.svc.id.goog

Key Standard Flags

FlagPurposeDefault
--zone or --regionCluster locationPrompted
--machine-typeVM type for default node poole2-medium
--num-nodesInitial node count in default pool3
--disk-sizeBoot disk size per node100GB
--disk-typepd-standard, pd-ssd, pd-balancedpd-standard
--enable-autoupgradeAuto-upgrade nodes to latest K8s versionEnabled
--enable-autorepairAuto-repair unhealthy nodesEnabled
--enable-ip-aliasVPC-native cluster (alias IPs)Enabled
--release-channelrapid, regular, stable; Standard can opt outregular
--workload-poolEnable Workload Identity Federation for GKEDisabled
--cluster-versionSpecific Kubernetes versionLatest in release channel
--enable-shielded-nodesSecure boot and integrity monitoringEnabled

Networking Configuration

VPC-Native vs Routes-Based

FeatureVPC-Native (Alias IPs)Routes-Based (Legacy)
Pod IP visibilityPods get IPs from VPC subnetPod IPs hidden behind node NAT
Network PoliciesFully supportedLimited support
Private GKE accessSupportedNot supported
RecommendedYesNo (deprecated)

Warning: Routes-based clusters are deprecated. Always use VPC-native clusters (--enable-ip-alias, which is now the default).

Private Clusters

# Private cluster — nodes have no public IPs
gcloud container clusters create my-private-cluster \
  --zone=us-central1-a \
  --enable-private-nodes \
  --enable-private-endpoint \
  --master-ipv4-cidr-block=172.16.0.0/28 \
  --master-authorized-networks=10.0.0.0/8
Private Cluster TypeControl Plane AccessNode Access
Private nodes + public endpointPublic IP (restricted by authorized networks)No public IP
Private nodes + private endpointPrivate IP only (requires VPN/Interconnect)No public IP

Tip: For most teams, private nodes with a public endpoint (restricted by --master-authorized-networks) is the right balance of security and convenience.

Release Channels

GKE release channels control how quickly your cluster receives Kubernetes updates:

ChannelCadenceRisk LevelBest For
RapidLatest features firstHigherExperimentation, dev
RegularBalanced cadenceMediumMost production clusters
StableConservative, well-testedLowestRisk-averse production
None (static)Pinned to specific versionVariableStrict compliance needs

Key Insight: GKE enrolls Autopilot clusters and new Standard clusters in a release channel by default. Standard clusters can opt out when you need static-version control, but then you must manage upgrades manually.

After Cluster Creation

# Get kubectl credentials
gcloud container clusters get-credentials CLUSTER_NAME \
  --zone ZONE \
  --project PROJECT_ID
 
# Verify the cluster
kubectl get nodes
kubectl cluster-info
 
# Deploy a test workload
kubectl create deployment hello-app --image=us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0
kubectl expose deployment hello-app --port=80 --target-port=8080 --type=LoadBalancer
 
# Check the deployment
kubectl get pods
kubectl get services

Useful Commands

CommandPurpose
gcloud container clusters listList all clusters in the project
gcloud container clusters describe NAME --zone ZONEDetailed cluster information
gcloud container clusters update NAME --zone ZONE --enable-autoupgradeEnable auto-upgrade on existing cluster
gcloud container clusters resize NAME --zone ZONE --num-nodes=NResize default node pool
gcloud container clusters delete NAME --zone ZONEDelete a cluster (irreversible)
kubectl get nodes -o wideList nodes with details
kubectl top nodesShow node resource usage

Warning: Deleting a cluster is permanent. All workloads, PersistentVolume data, and configurations are lost. Use --async flag to avoid blocking your terminal during deletion.

Common Pitfalls

PitfallConsequenceFix
Creating cluster in wrong zone/regionHigher latency, potential data residency issuesUse --region for regional clusters in production
Not enabling IP aliasCannot use Network Policies, limited VPC integrationUse VPC-native (default for new clusters)
Open master authorized networksControl plane accessible from any IPRestrict with --master-authorized-networks
Opting out of release channelsManual upgrades, may fall behind on security patchesKeep the default release channel or explicitly use --release-channel=regular
Using default networkNo network isolation from other resourcesCreate a dedicated VPC or subnet
Forgetting to get credentialskubectl commands fail with connection errorRun get-credentials after creating the cluster

TL;DR

  • Use gcloud container clusters create-auto for Autopilot, gcloud container clusters create for Standard
  • Always use VPC-native clusters (the default)
  • Enable a release channel (--release-channel=regular) for automatic upgrades
  • Use private nodes with restricted master authorized networks for production
  • Run get-credentials after creation to configure kubectl
  • Set --workload-pool to enable Workload Identity Federation for GKE

Resources