0
0
GCPcloud~5 mins

GKE cluster creation (Autopilot vs Standard) in GCP - CLI Comparison

Choose your learning style9 modes available
Introduction
Creating a Kubernetes cluster on Google Cloud lets you run and manage containerized apps easily. You can choose Autopilot mode for hands-off management or Standard mode for full control over your cluster's resources.
When you want Google to manage the infrastructure and scaling automatically without manual intervention.
When you need full control over node configuration and want to customize your cluster setup.
When you want to quickly deploy a cluster without worrying about node management.
When you want to optimize costs by only paying for the resources your pods use.
When you want to run workloads that require specific node customizations or special hardware.
Commands
This command creates a GKE Autopilot cluster named 'example-autopilot-cluster' in the 'us-central1' region. Autopilot mode means Google manages the nodes and scaling for you.
Terminal
gcloud container clusters create-auto example-autopilot-cluster --region us-central1
Expected OutputExpected
Creating cluster example-autopilot-cluster in us-central1... Created [https://container.googleapis.com/v1/projects/my-project/locations/us-central1/clusters/example-autopilot-cluster]. To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/list?project=my-project kubeconfig entry generated for example-autopilot-cluster. NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS example-autopilot-cluster us-central1 1.26.3-gke.100 35.202.123.45 Autopilot 1.26.3-gke.100 3 RUNNING
--region - Specifies the region where the cluster will be created.
This command creates a GKE Standard cluster named 'example-standard-cluster' in the 'us-central1-a' zone with 3 nodes of type 'e2-medium'. You manage the nodes and scaling yourself.
Terminal
gcloud container clusters create example-standard-cluster --zone us-central1-a --num-nodes 3 --machine-type e2-medium
Expected OutputExpected
Creating cluster example-standard-cluster in us-central1-a... Created [https://container.googleapis.com/v1/projects/my-project/zones/us-central1-a/clusters/example-standard-cluster]. To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/list?project=my-project kubeconfig entry generated for example-standard-cluster. NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS example-standard-cluster us-central1-a 1.26.3-gke.100 34.68.234.56 e2-medium 1.26.3-gke.100 3 RUNNING
--zone - Specifies the zone where the cluster will be created.
--num-nodes - Sets the initial number of nodes in the cluster.
--machine-type - Defines the type of virtual machine for each node.
This command lists the nodes in the current Kubernetes cluster to verify the cluster is running and nodes are ready.
Terminal
kubectl get nodes
Expected OutputExpected
NAME STATUS ROLES AGE VERSION example-standard-cluster-default-pool-1 Ready <none> 2m v1.26.3-gke.100
Key Concept

If you remember nothing else from this pattern, remember: Autopilot mode lets Google manage your cluster nodes automatically, while Standard mode gives you full control over node setup and scaling.

Common Mistakes
Trying to use node customization flags with Autopilot clusters.
Autopilot mode does not allow manual node configuration; it manages nodes automatically.
Use Standard clusters if you need to customize nodes or control scaling.
Not specifying region or zone correctly when creating clusters.
The cluster creation will fail or create in an unexpected location.
Always specify --region for Autopilot and --zone for Standard clusters explicitly.
Assuming Autopilot clusters have visible nodes with kubectl get nodes.
Autopilot nodes are managed by Google and may not appear as standard nodes.
Use kubectl get pods and other commands to check workload status in Autopilot clusters.
Summary
Use 'gcloud container clusters create-auto' to create an Autopilot cluster where Google manages nodes.
Use 'gcloud container clusters create' with zone, node count, and machine type to create a Standard cluster with manual node control.
Verify cluster nodes with 'kubectl get nodes' to ensure your cluster is running and ready.