Learning how to create a gke cluster is the fastest way to run containerized applications on Google Cloud without managing Kubernetes control planes yourself. Google Kubernetes Engine (GKE) is a managed Kubernetes service: Google operates the control plane, upgrades, and underlying infrastructure, while you focus on deploying workloads. In this guide you will create a gke cluster, connect to it with kubectl, deploy an Nginx application with three replicas, expose it through a LoadBalancer, scale it, and clean everything up so you stop paying for resources you no longer need.
GKE offers two modes of operation. Autopilot is the recommended, fully managed mode: Google manages nodes, scaling, security configuration, and resource provisioning, and you pay for the pods you run. Standard mode gives you full control over node pools, machine types, and node configuration, which suits specialized workloads but requires more operational work. If you are just starting out, Autopilot is the simplest way to create a gke cluster that is production-ready by default. Before your first cluster, it also helps to understand containers locally — see our guides to install Minikube on Ubuntu for local Kubernetes and install Docker on Ubuntu 24.04 for container basics.
Prerequisites to Create a GKE Cluster
Before you create a gke cluster, make sure you have the following ready:
- A Google Cloud project with billing enabled. GKE clusters use Compute Engine resources, so an active billing account is required even if you stay within free-tier limits.
- The Google Cloud CLI (
gcloud) installed and authenticated. Rungcloud initand select your project. kubectlinstalled. You can install it through gcloud withgcloud components install kubectl.- Basic knowledge of Kubernetes concepts such as pods, deployments, and services.
gcloud auth login
gcloud config set project YOUR_PROJECT_ID
gcloud components install kubectl
kubectl version --client

Step 1: Enable the Kubernetes Engine API
Every Google Cloud service must be enabled per project. Enable the Container API once, then you can create a gke cluster in that project:
gcloud services enable container.googleapis.com
This command may take a minute to complete. You only need to run it once per project.
Step 2: Create a GKE Cluster in Autopilot Mode
Autopilot removes node management entirely. One command is enough to create a gke cluster that scales automatically and follows Google’s security best practices:
gcloud container clusters create-auto my-first-cluster \
--region us-central1 \
--project YOUR_PROJECT_ID
Cluster creation usually takes three to five minutes. Autopilot provisions the control plane and a managed node infrastructure, configures Workload Identity, and enables automatic upgrades and repairs. You are billed for the CPU and memory your pods request, not for idle node capacity, which makes Autopilot cost-effective for most web applications, APIs, and microservices.
Creating a Standard Cluster Instead
If you need custom machine types, GPUs, or specific node settings, use Standard mode. The basic command to create a gke cluster in Standard mode looks like this:
gcloud container clusters create my-standard-cluster \
--zone us-central1-a \
--num-nodes 3 \
--machine-type e2-medium
With Standard clusters you choose the zone, node count, and machine type, and you are responsible for sizing node pools correctly. For learning purposes, three small nodes are more than enough.
Step 3: Get Credentials and Verify the Connection
After you create a gke cluster, fetch its credentials so kubectl knows where to connect. This writes an entry into your local kubeconfig file:
gcloud container clusters get-credentials my-first-cluster \
--region us-central1
Now verify the connection by listing the nodes:
kubectl get nodes
kubectl cluster-info
You should see your nodes in a Ready state and the address of the Kubernetes control plane. If this works, your cluster is ready to accept workloads.
Step 4: Deploy Your First Application
Create a file named nginx-deployment.yaml with a simple Deployment that runs three replicas of Nginx:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.27
ports:
- containerPort: 80
Apply it and watch the pods come up:
kubectl apply -f nginx-deployment.yaml
kubectl get pods -w
Within a minute all three pods should show Running status. Kubernetes maintains the desired state automatically: if a pod crashes, the Deployment controller replaces it.
Step 5: Expose the Application with a LoadBalancer Service
Pods are reachable inside the cluster, but external users need a Service. Create nginx-service.yaml:
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
type: LoadBalancer
selector:
app: nginx
ports:
- port: 80
targetPort: 80
kubectl apply -f nginx-service.yaml
kubectl get services
Google Cloud provisions a network load balancer and assigns an external IP address. Once the EXTERNAL-IP column changes from <pending> to a real address, open that IP in your browser and you will see the Nginx welcome page served by your cluster.
Step 6: Scale the Deployment
Scaling is a single command. This is one of the main reasons teams create a gke cluster instead of running containers on individual virtual machines:
kubectl scale deployment nginx-deployment --replicas=5
kubectl get pods
Kubernetes schedules the two additional pods automatically. In Autopilot, Google also provisions the underlying capacity, so scaling works without any node management on your side.
Step 7: Clean Up to Stop Billing
Clusters incur charges for as long as they exist. When you finish experimenting, delete the service first (to remove the load balancer), then delete the cluster:
kubectl delete service nginx-service
gcloud container clusters delete my-first-cluster --region us-central1
Confirm the deletion when prompted. Always clean up test clusters — an idle cluster left running over a weekend is a common source of surprise cloud bills.
Troubleshooting When You Create a GKE Cluster
kubectl Cannot Connect to the Cluster
Errors such as Unable to connect to the server almost always mean credentials are missing or stale. Re-run the get-credentials command for the correct cluster name, region, and project, then check kubectl config current-context.
Pods Stuck in Pending
Pending pods usually indicate insufficient quota or resources. Check events with kubectl describe pod POD_NAME. In Standard mode you may need larger nodes or more nodes; in Autopilot, verify your project’s CPU quota in the Cloud Console and request an increase if necessary.
LoadBalancer IP Stuck on <pending>
Provisioning normally takes one to three minutes. If it stays pending much longer, check for quota limits on forwarding rules and IP addresses, and confirm the cluster was created in a region with available capacity. Deleting and recreating the Service often resolves transient provisioning errors.
Conclusion
You now know how to create a gke cluster in both Autopilot and Standard modes, connect with kubectl, deploy a replicated application, expose it with a LoadBalancer, scale it, and delete it cleanly. Autopilot is the right default for most workloads, while Standard mode is there when you need node-level control. For deeper configuration options, Helm charts, and production hardening, consult the official Google Kubernetes Engine documentation and keep experimenting in short, cleaned-up sessions to keep costs under control.