Google Kubernetes Engine (GKE)
Autopilot versus Standard clusters, how each is billed, and connecting kubectl with get-credentials.
On this page6 sections
GKE is Google Cloud's managed Kubernetes. Google runs the control plane (API server, scheduler, etcd) for you. How much of the rest you manage depends on the cluster's mode. If Kubernetes itself is new to you, the Containers & Kubernetes track covers Pods, Deployments, and Services first.
Autopilot versus Standard
| Autopilot | Standard | |
|---|---|---|
| Nodes | Google provisions, scales, patches, and secures them | You create and manage node pools |
| Billing | For your Pods' CPU and memory requests | For the whole VMs, used or not |
| Location | Regional (spread across zones) | Zonal or regional |
| Best for | Most workloads | Special hardware or node-level tuning |
Google's documentation calls Autopilot the recommended way to use GKE. You describe workloads, and Google makes sure there is capacity for them. Because you pay for what Pods request rather than for idle nodes, right-sizing your requests directly lowers the bill.
Creating a cluster
gcloud services enable container.googleapis.com
gcloud container clusters create-auto demo-cluster --location=us-central1
--location takes a region for a regional cluster (Autopilot always is) or a zone for a zonal Standard cluster. A Standard cluster is created with gcloud container clusters create instead, and you choose node counts and machine types yourself.
Connecting kubectl
gcloud container clusters get-credentials demo-cluster --location=us-central1
kubectl get nodes
get-credentials writes an entry into your kubeconfig (~/.kube/config) and switches kubectl's current context to the new cluster. kubectl authenticates through the gke-gcloud-auth-plugin, which you install with gcloud components install gke-gcloud-auth-plugin if it is missing.
Running workloads securely
- Give Pods Google Cloud access through Workload Identity Federation for GKE. It maps a Kubernetes service account to IAM, so you never mount service account keys into Pods. Autopilot clusters have it enabled by default.
- Always set CPU and memory requests. In Autopilot they decide both scheduling and price.
- Prefer regional clusters for production, so a single zone outage doesn't take the control plane or all your nodes with it.
Try it
gcloud container clusters create-auto demo-cluster --location=us-central1-a
gcloud container clusters create-auto demo-cluster --location=us-central1
gcloud container clusters list
gcloud container clusters get-credentials demo-cluster --location=us-central1
cat ~/.kube/config
The first command fails on purpose: Autopilot clusters are regional, so a zone is rejected.
When you're ready, hit Mark complete. That completes the Google Cloud lessons.
Further reading
- Autopilot overview (opens in a new tab) - how Autopilot differs from Standard, including billing.
- gcloud container clusters create-auto (opens in a new tab) - the command reference and location flags.
- Install kubectl and configure cluster access (opens in a new tab) - get-credentials and the auth plugin.
Challenge
Create an Autopilot cluster named demo-cluster in the us-central1 region.
Want to experiment first? Try things in the practice terminal (opens in a new tab), then enter the command that solves the task here.
Quiz
Lock in the concepts. Score at least 80% to mark the lesson complete.
Done with this one?
Skipped the challenge? You can mark the lesson complete by hand.