Google Kubernetes Engine (GKE)

Google Kubernetes Engine (GKE)

A complete, beginner-friendly guide to running containers at any scale on Google Cloud: how GKE works inside, why teams choose it, and how to run it well in production.

In July 2016, a mobile game called Pokémon GO launched and drew far more players than anyone had planned for. Its maker, Niantic, has publicly shared that the game’s backend ran on Google Kubernetes Engine, and that the platform was able to grow to meet a flood of traffic that would have flattened a traditional setup. A few years later, Spotify moved a large share of its backend services onto the same kind of platform. Two very different companies, one shared idea: stop babysitting individual servers and let a smart system run your software for you.

That smart system is Kubernetes, and the easiest way to use it on Google Cloud is Google Kubernetes Engine, usually shortened to GKE. This guide assumes you know nothing about any of these words. We will build up slowly: what a container is, what Kubernetes does with containers, and what Google adds on top. By the end, you will understand how a GKE cluster is built, how a request travels through it, how it grows and heals, how to keep it safe, and how to keep the bill under control.

1What Is GKE and Why Does It Exist?

Before we talk about GKE, we need three simple ideas: a container, an orchestrator, and a managed service.

Start with the problem

Every application is a pile of code that needs a computer to run on. A small website might need one computer. A big service like a video app or a ride-hailing app needs thousands of programs running at once, spread across hundreds of computers. Those programs must find each other, share traffic fairly, restart when they crash, and update without the users noticing. Doing this by hand is like running a huge hotel with a single receptionist: it works for five guests and collapses at five thousand.

What is a container?

A container is a sealed box that holds one program together with everything that program needs to run: its code, its libraries, and its settings. The box runs the same way on a laptop, on a test machine, and on a production server. The blueprint used to make a container is called an image. You build an image once, then start as many identical containers from it as you like.

Everyday analogy

Think of the steel shipping containers on cargo ships. It does not matter whether the box holds shoes or bananas. Every crane, truck and ship knows how to lift, stack and move the same standard box. Software containers do the same job for programs: the machine running them does not need to know what is inside.

What is Kubernetes?

If you have ten containers, you can start them yourself. If you have ten thousand, you need a manager. Kubernetes (often written K8s) is open-source software that acts as that manager. You tell it what you want, for example “keep five copies of my checkout program running at all times”, and it makes that true and keeps it true. If a computer dies, Kubernetes starts replacement copies elsewhere. If traffic grows, it can add more copies. A group of computers managed together by Kubernetes is called a cluster.

Everyday analogy

Kubernetes is the conductor of an orchestra. The musicians (containers) know how to play their parts. The conductor decides who plays, when they start, and who steps in if a player falls ill. The conductor never plays an instrument.

What does “managed” mean?

Kubernetes itself is complicated to install and to keep healthy. It has a “brain” made of several programs that must be upgraded, backed up, secured and kept available around the clock. A managed service means a cloud company runs that hard part for you. GKE is Google’s managed Kubernetes service. Google runs the brain of the cluster, patches it, scales it, and fixes it when it breaks. You focus on your own applications.

Managed brain

No control plane chores

Google operates, upgrades and repairs the Kubernetes management components for you.

Self-healing

Automatic repair

Broken computers are detected and replaced automatically, and crashed containers are restarted.

Elastic

Grows and shrinks

Add copies of your program, and add or remove computers, as demand changes.

Integrated

Part of Google Cloud

Works with Google’s load balancers, networks, disks, security tools, logging and monitoring.

Portable

Standard Kubernetes

Your workload descriptions follow open standards, so skills and tools carry over to other platforms.

Two modes

Autopilot or Standard

Pick hands-off operation or fine-grained control over the machines underneath.

i
Tip

GKE is not a different product from Kubernetes. It is Kubernetes, run by Google, with Google Cloud features wired in. Everything you learn about Kubernetes applies directly.

2A Short History: From Borg to GKE

GKE sits on top of more than twenty years of lessons learned from running giant systems at Google.

Google runs services like Search, Gmail and YouTube for billions of people. In the early 2000s its engineers built an internal system called Borg to start, stop and supervise millions of jobs across enormous fleets of machines. Borg taught Google hard lessons: pack many workloads onto shared machines to save money, describe what you want instead of giving step-by-step orders, and let software heal itself because humans are too slow. A second internal system, Omega, tested new ideas on scheduling.

In 2014 Google released a fresh, open-source system built on those lessons and called it Kubernetes, a Greek word for a ship’s helmsman. Releasing it openly was a big decision. It allowed other companies, and later every major cloud, to adopt the same standard. Kubernetes was handed to a neutral home, the Cloud Native Computing Foundation, so that no single company would own it.

2014
Kubernetes released as open source
2015
Google’s managed offering reaches general availability
2021
Autopilot mode introduced
1

Borg era

Google runs its own services on an internal cluster manager, proving the idea at huge scale.

2

Kubernetes is open-sourced

The core ideas of Borg are rewritten for the outside world and shared freely.

3

Google Container Engine, later GKE

Google launches a managed service in 2015 and renames it Google Kubernetes Engine in 2017.

4

Maturity features

Regional clusters, private clusters, release channels, node auto-repair and many security features arrive over the following years.

5

Autopilot and AI workloads

Autopilot removes node management entirely, and GKE adds strong support for GPUs and TPUs for machine learning work.

Google did not invent the idea of managing containers. It productized the experience of running them at planetary scale.

3Core Concepts You Must Know

Kubernetes has its own vocabulary. Learn these ten words and the rest of the guide will feel easy.

Everyday analogy

Picture a shopping mall. The mall building is the cluster. Each shop floor is a node. Each shop on a floor is a Pod. The mall management office decides which shop opens on which floor. Keep this picture in mind as we go.

ConceptWhat it isMall analogy
ClusterThe whole set of machines plus the management brainThe mall
NodeOne computer (a virtual machine on Google Cloud) that runs your workloadsA floor of the mall
Node poolA group of nodes that share the same machine type and settingsAll floors built to the same design
PodThe smallest unit: one or more tightly linked containers sharing a network addressA shop
DeploymentA rule saying “keep this many identical Pods running, and update them safely”A franchise contract: always keep five branches open
ServiceA stable address that sends traffic to a changing set of PodsThe mall’s information desk that always knows where the shoe shop is
NamespaceA named partition inside a cluster for separating teams or environmentsSeparate wings of the mall
ConfigMap and SecretSettings and sensitive values handed to Pods from outside the imageOpening instructions and the safe’s key
Ingress or GatewayRules that bring outside internet traffic to the right ServiceThe main entrance with signs
LabelA name tag attached to objects so they can be grouped and foundCategory stickers like “food” or “electronics”

Why Pods and not just containers?

Sometimes a program needs a small helper beside it, such as a tool that collects its logs or a proxy that handles secure connections. Putting both in one Pod guarantees they always land on the same machine and can talk to each other over a private local connection. Most Pods contain just one main container, and that is perfectly normal.

Pods are disposable

This is the single most important mindset shift. A Pod is not a pet. It can be killed and replaced at any moment: because a machine failed, because you shipped a new version, or because the cluster is making room. Its IP address changes when it is replaced. That is why Services exist. You never talk to a Pod directly; you talk to the Service in front of it.

Everyday analogy

A Deployment is like a restaurant manager who is told to keep five waiters on the floor. If one waiter goes home sick, the manager calls in another. Customers never ask for a waiter by name; they just ask whoever is free. Pods are the waiters, the Service is the “next available waiter” rule.

Declarative thinking

In Kubernetes you describe the desired state, such as “five copies of version 2.1 of my app”. You do not write the steps to get there. Kubernetes constantly compares the real world to your description and corrects any difference. Engineers call this a reconciliation loop, and it is the beating heart of the whole system.

i
Remember

Desired state in, reality adjusted to match. Nearly every confusing Kubernetes behavior becomes clear once you ask, “What is the desired state, and what is different in reality right now?”

4Architecture and Components

A GKE cluster has two halves: a brain that Google runs, and a body of machines that run your work.

The control plane: the brain

The control plane is a set of programs that make decisions for the cluster. In GKE, Google hosts it in a Google-managed project, so you never see those machines and never patch them. It contains:

  • API server: the front door. Every command, whether from an engineer, a tool or another program, goes through it. It checks who you are and whether you are allowed to do the thing you asked.
  • Datastore (etcd in the open-source design): the cluster’s memory, holding every desired state and current fact. It is replicated so that losing one copy does not lose the cluster’s memory.
  • Scheduler: decides which node should run each new Pod, based on free capacity, rules and preferences.
  • Controller manager: a collection of small robots, each watching one kind of object and fixing differences between desired and real state.
  • Cloud controller: the translator that creates Google Cloud things, such as load balancers and disks, when Kubernetes objects ask for them.

The nodes: the body

Nodes are Compute Engine virtual machines in your own Google Cloud project. Each node runs a few standard programs:

  • kubelet: the node’s local manager. It receives instructions from the control plane and makes sure the right containers are running on its machine.
  • Container runtime: the program that actually starts containers (containerd in GKE).
  • Networking components: set up Pod addresses and enforce traffic rules, so Pods on different nodes can reach each other.
  • Agents for logs and metrics: send observations to Google’s monitoring services.
flowchart TB
  U["Engineer or CI tool"] --> API
  subgraph CP["Google-managed control plane"]
    API["API Server"]
    ET["Cluster datastore"]
    SCH["Scheduler"]
    CM["Controller Manager"]
    CCM["Cloud Controller"]
    API --- ET
    API --- SCH
    API --- CM
    API --- CCM
  end
  subgraph PROJ["Your Google Cloud project"]
    subgraph NP1["Node pool A"]
      N1["Node 1 with kubelet"] --> P1["Pods"]
      N2["Node 2 with kubelet"] --> P2["Pods"]
    end
    subgraph NP2["Node pool B"]
      N3["Node 3 with kubelet"] --> P3["Pods"]
    end
  end
  API --> N1
  API --> N2
  API --> N3
  CCM --> LB["Cloud Load Balancer"]
  LB --> P1
  LB --> P3
  P1 --> LOG["Cloud Logging and Monitoring"]
  AR["Artifact Registry"] --> N1
    
Figure 1: A GKE cluster. Google runs the control plane; the nodes and your Pods live in your own project.

Read the diagram from the top. An engineer sends a request to the API server. The API server stores it, the scheduler picks a node, and the kubelet on that node pulls the container image from Artifact Registry and starts it. When a Service of type load balancer is requested, the cloud controller asks Google Cloud to create a real load balancer that forwards traffic into the Pods.

Who is responsible for what?

AreaGoogle handlesYou handle
Control planeRunning, patching, scaling, repairingChoosing version channel and maintenance timing
Nodes (Autopilot)Almost everything, including provisioning and upgradesDeclaring Pod resource needs
Nodes (Standard)Offers auto-upgrade and auto-repair toolsMachine types, pool sizes, upgrade strategy
ApplicationsNothingCode, images, configuration, scaling rules
Security of workloadsSecure base images and platform defaultsAccess rules, secrets, network rules, image trust
!
Watch out

“Managed” does not mean “nothing to do”. Google protects the platform, but a badly written application, a leaked password or an over-powerful access rule is still your problem. This is known as the shared responsibility model.

5Autopilot vs Standard: Choosing Your Mode

GKE offers two ways to operate a cluster. The difference is how much of the machine layer you want to own.

Standard mode

In Standard mode you design the nodes yourself. You pick the machine type, the number of machines, the disks, the zones, and when and how upgrades happen. You are billed for the virtual machines in your node pools, whether they are busy or idle. This gives you the most control, and also the most responsibility.

Autopilot mode

In Autopilot mode Google also manages the nodes. You never create node pools. You simply tell the cluster how much CPU and memory each Pod needs, and Google finds or creates capacity for it. Autopilot applies many security and reliability settings by default and bills mainly for the resources your Pods request rather than for whole machines.

Everyday analogy

Standard is like leasing an entire office floor: you choose the desks, pay for every desk whether or not someone sits there, and handle the cleaning schedule. Autopilot is like renting a seat in a co-working space: you pay for what you use, and the building team handles furniture, cleaning and power.

QuestionAutopilotStandard
Who manages nodes?GoogleYou, with Google’s automation tools
What do you pay for?Resources requested by running Pods, plus a cluster feeEvery node VM you run, plus a cluster fee
Wasted idle capacity?Mostly avoided, since unused room is not billed to youYour responsibility to pack nodes well
Security defaultsHardened by default, with some risky settings blockedMany hardening steps are optional and left to you
Special hardwareSupported through compute classes and accelerator choicesFull choice of machine families and custom setups
Privileged or node-level tricksRestrictedAllowed
Best forMost application teams who want less operational workTeams with special hardware, kernel or tuning needs

When Autopilot is the natural choice

A small product team runs ten web services and has no dedicated platform engineers. They want rolling updates, autoscaling and good security without learning about machine types. Autopilot removes a whole category of decisions.

When Standard is the natural choice

A platform team runs a specialized workload that needs a particular machine family, local disks, or a node-level agent that Autopilot restricts. They accept the extra work in exchange for control.

!
Watch out

Autopilot bills on what Pods request, not what they actually use. If every Pod asks for far more memory than it needs, you still pay for the full request. Right-sizing requests matters in both modes, but in Autopilot it directly drives the bill.

6Internal Working: What Happens When You Deploy

Let us follow one small request through the machinery to see how the pieces cooperate.

Suppose you ask GKE for “three copies of my shopping-cart service, version 2”. Here is the journey, step by step.

1

You submit the request

A tool sends your description to the API server over an encrypted connection.

2

Identity and permission checks

The API server confirms who you are, checks that you are allowed to create Deployments in that namespace, and runs validation rules that can reject unsafe requests.

3

The desired state is stored

The API server writes “three copies wanted” into the cluster datastore. Nothing is running yet, but the intention is now recorded.

4

Controllers create Pods

The Deployment controller notices the new object and creates a ReplicaSet. The ReplicaSet controller notices that zero of three Pods exist and creates three Pod records, still without a home.

5

The scheduler picks nodes

It filters out nodes that lack space or break rules, scores the rest, and assigns each Pod to a node. In Autopilot, if no node has room, the platform adds capacity.

6

The kubelet starts containers

The kubelet on each chosen node sees its new Pod, pulls the image if needed, asks the container runtime to start it, and attaches networking and storage.

7

Health reports flow back

The kubelet reports status. Once health checks pass, the Pod is marked ready and starts receiving traffic.

sequenceDiagram
  participant E as Engineer
  participant A as API Server
  participant D as Datastore
  participant C as Controllers
  participant S as Scheduler
  participant K as Kubelet on node
  E->>A: Submit Deployment with 3 replicas
  A->>A: Authenticate, authorize, validate
  A->>D: Save desired state
  C->>A: Watch and see new Deployment
  C->>A: Create ReplicaSet and 3 Pods
  S->>A: Watch and see unassigned Pods
  S->>A: Bind each Pod to a node
  K->>A: Watch and see Pod assigned to me
  K->>K: Pull image and start containers
  K->>A: Report Pod running and ready
    
Figure 2: How a Deployment becomes running Pods. Every component talks only to the API server.

The hub-and-spoke secret

Notice that the scheduler, controllers and kubelets never talk directly to each other. Each one watches the API server for changes it cares about, does its small job, and writes the result back. This design makes the system easy to extend and easy to recover: if a component crashes, it restarts, reads the current state, and carries on.

Everyday analogy

Think of a thermostat. You set the desired temperature. The thermostat keeps measuring the room and turns the heater on or off to close any gap. It does not follow a script of “heat for ten minutes”; it simply keeps correcting. Kubernetes controllers behave the same way, thousands of times per minute, for everything in the cluster.

What happens when something breaks?

If a node dies, the control plane stops hearing from its kubelet. After a short grace period it marks the node as unhealthy and the Pods there as lost. The ReplicaSet controller sees that only two of three copies exist and creates a replacement, which the scheduler places on a healthy node. You did not issue any command. The loop did its job. On Standard clusters, GKE node auto-repair also replaces the broken machine itself.

i
Interview-ready insight

A strong one-line summary of Kubernetes is: “a set of independent control loops that continuously reconcile desired state, stored in a consistent datastore, with the actual state of the world.”

7Networking in GKE

Networking is where most beginners get lost, so we will take it one layer at a time.

Every Pod gets its own address

Kubernetes promises that every Pod has its own IP address and can talk to every other Pod without tricks. GKE delivers this using a VPC-native design. Your cluster uses ranges of addresses inside your Google Cloud network, called alias IP ranges. One range is reserved for nodes, one for Pods and one for Services. Because Pod addresses are real addresses in your network, other Google Cloud resources can reach them directly and network tools understand them.

Services: a stable address for a moving crowd

Since Pods come and go, clients need a fixed address. A Service provides it. The common types are:

  • ClusterIP: reachable only from inside the cluster. Used for service-to-service calls.
  • NodePort: opens a port on every node. Rarely used directly today.
  • LoadBalancer: asks Google Cloud to create a load balancer with a public or internal address.

Inside the cluster, a built-in DNS service lets Pods find each other by name, such as “payments” instead of an IP address, so developers never hard-code addresses.

Bringing the internet in: Ingress and Gateway

For web traffic, you usually want one public entrance that routes by address and path: shop pages go to one Service, API calls go to another. GKE supports the older Ingress object and the newer, more expressive Gateway API. Both create Google’s global load balancers, which accept traffic at Google’s edge locations around the world and carry it over Google’s private backbone. With container-native load balancing, the load balancer sends requests straight to Pods using network endpoint groups, skipping an extra hop through the nodes. That lowers delay and spreads traffic more evenly.

Everyday analogy

A Service is a company’s phone number that always reaches whoever is on duty. The load balancer is the receptionist who answers the call and forwards it to a free staff member. With container-native load balancing, the receptionist dials the staff member’s desk directly instead of ringing the floor’s main line first.

flowchart LR
  USER["User on the internet"] --> DNS["DNS name"]
  DNS --> ARMOR["Cloud Armor rules"]
  ARMOR --> GLB["Global external load balancer"]
  GLB --> GW["Gateway and routing rules"]
  GW --> NEG1["Endpoint group zone A"]
  GW --> NEG2["Endpoint group zone B"]
  NEG1 --> POD1["Pod 1"]
  NEG1 --> POD2["Pod 2"]
  NEG2 --> POD3["Pod 3"]
  POD1 --> SVC["Internal Service for payments"]
  SVC --> POD4["Payments Pod"]
  POD4 --> NAT["Cloud NAT for outbound calls"]
  NAT --> EXT["External API"]
    
Figure 3: A request from the internet to Pods, and an outbound call leaving the cluster.

Controlling who may talk to whom

By default, any Pod can talk to any other Pod. That is convenient and also dangerous: one hacked Pod could probe everything. Network policies are firewall rules for Pods, such as “only the checkout Pods may call the payments Pods”. GKE’s modern networking layer, called Dataplane V2, is built on eBPF technology from the Linux kernel and has network policy enforcement built in. It also gives better visibility into traffic and is used by default in Autopilot.

Private clusters and outbound access

In a private cluster, nodes have no public IP addresses, so they cannot be reached directly from the internet. The control plane can also be limited to trusted address ranges. Private nodes still need to download images and call outside services, which is done through Cloud NAT, a managed gateway for outbound-only traffic.

Going bigger: many clusters

Large companies often run several clusters, in different regions for resilience or for different teams. Google offers fleet features, multi-cluster Services and multi-cluster Gateways so these clusters can be treated as a group, with traffic steered to the closest healthy one.

!
Watch out

Plan address ranges before creating a cluster. Pod and Service ranges are hard to change later, and a range that is too small stops the cluster from growing. Running out of Pod addresses is one of the most common surprise failures in growing clusters.

8Storage and Data

Containers forget everything when they stop. If your program needs to remember, you need storage that outlives the container.

Ephemeral versus persistent

A container’s own filesystem is ephemeral: it vanishes when the Pod is replaced. That is fine for temporary scratch files and terrible for a database. Persistent storage lives outside the Pod and can be attached to a new Pod after the old one is gone.

Everyday analogy

Ephemeral storage is a whiteboard in a meeting room: whatever you write is wiped after the meeting. Persistent storage is a filing cabinet in a corridor: any team that books the room can walk out and open the same cabinet.

The three objects behind persistent storage

Request

PersistentVolumeClaim

A Pod’s request: “I need 100 gigabytes of fast disk.” It is like a booking form.

Supply

PersistentVolume

The real disk that satisfies a claim. In GKE it is created automatically on demand.

Recipe

StorageClass

The menu of disk types you can ask for, such as standard, balanced or high-performance.

Stateful apps

StatefulSet

Like a Deployment, but each Pod keeps a stable name and its own disk, which suits databases and queues.

What storage options does GKE offer?

OptionShapeTypical use
Persistent Disk and HyperdiskNetwork block disk attached to one node at a time; zonal or regional replication availableDatabases, single-writer applications
FilestoreShared file system many Pods can mount togetherShared content, legacy apps that expect a file share
Cloud Storage buckets via a mounting driverObject storage presented as foldersMachine learning datasets, large read-heavy files
Local SSDVery fast disk physically attached to the node, lost if the node is lostCaches and scratch space

Zones matter for disks

A standard persistent disk lives in one zone, and a Pod using it must run in that same zone. If that zone has trouble, the disk is unavailable. Regional disks keep a copy in two zones, so a replacement Pod can start in the other zone. This is a classic trade-off: regional disks cost more and write a little slower, but survive a zone failure.

Should databases run inside the cluster?

You can run databases on GKE, and many teams do for specialized needs. But databases are the hardest workloads to run safely: backups, failover, upgrades and tuning all demand care. A common, sensible pattern is to run the stateless parts of your system, the web servers and workers, on GKE, and use managed database services such as Cloud SQL, Spanner or Firestore for the data. Then Google handles the hard parts of the data layer, too.

Backing up the cluster itself

Backup for GKE can capture both the cluster’s configuration and the data on persistent volumes, so you can restore into the same or another cluster after a mistake or a disaster. Treat it as a safety net for the stateful pieces you chose to run yourself.

i
Tip

Keep Pods stateless whenever you can. A stateless Pod can be killed, copied or moved freely, which is exactly what makes scaling and healing easy.

9Data Flow and Pod Lifecycle

Two journeys matter: the journey of a user’s request, and the life story of a Pod.

The journey of one user request

Imagine a shopper taps “Add to cart” in a mobile app. The request leaves the phone and arrives at Google’s nearest edge location. A global load balancer checks security rules, picks a healthy region and zone, and forwards the request straight to a ready Pod running the cart service. That Pod may call other Services inside the cluster, such as inventory or pricing, using their internal names. Each call is balanced across the healthy Pods behind that Service. The cart Pod then writes to a managed database, builds a response, and sends it back along the same path. The whole trip often takes a fraction of a second.

The life story of a Pod

A Pod moves through clear phases, and understanding them makes debugging much easier.

1

Pending

The Pod is accepted but not running yet. It may be waiting for a node, or for its image to download. A Pod stuck here usually means “no room” or “cannot pull the image”.

2

Starting and probing

Containers start. A startup probe gives slow programs time to wake up before other checks begin.

3

Running and ready

A readiness probe tells Kubernetes the Pod can accept traffic. If it fails, the Pod is quietly removed from the Service until it recovers.

4

Staying alive

A liveness probe checks the program is not frozen. If it fails repeatedly, the container is restarted.

5

Terminating

When a Pod must go, it is first removed from traffic, then told to shut down politely, given a grace period to finish current requests, and only then force-stopped.

flowchart TD
  A["Deployment applied"] --> B["Pod created: Pending"]
  B --> C{"Node with free room?"}
  C -- "No" --> D["Autoscaler adds capacity"]
  D --> E["Image pulled"]
  C -- "Yes" --> E
  E --> F["Containers start"]
  F --> G{"Startup and readiness probes pass?"}
  G -- "No" --> H["Not in Service, may restart"]
  H --> G
  G -- "Yes" --> I["Receives traffic"]
  I --> J{"Update or node drain?"}
  J -- "No" --> I
  J -- "Yes" --> K["Removed from Service, graceful shutdown"]
  K --> L["Replacement Pod created"]
    
Figure 4: The lifecycle of a Pod from creation to replacement.
Everyday analogy

A readiness probe is a restaurant waiter who only goes out to the dining room after tying the apron and washing hands. A liveness probe is a manager who checks whether the waiter is still responding. A graceful shutdown is the waiter finishing the dishes already ordered before going home.

!
Watch out

Missing or sloppy readiness probes are a top cause of failed releases. Without them, Kubernetes sends traffic to a Pod the moment its container starts, even if the program inside is still loading. Users then see errors during every update.

Configuration and secrets in the flow

Programs should not have passwords baked into their images. ConfigMaps hand ordinary settings to Pods at start time, while Secrets carry sensitive values. Because the same image can run in test and production with different settings, you build once and deploy everywhere.

10Scaling and Performance

Scaling means matching capacity to demand: more when busy, less when quiet. GKE can do this at three levels.

Level 1: more or fewer Pods

The Horizontal Pod Autoscaler (HPA) watches a signal, usually CPU use, memory, or a custom number such as requests per second or queue length, and changes the number of Pod copies to keep that signal near a target. This is called scaling out and in.

Level 2: bigger or smaller Pods

The Vertical Pod Autoscaler (VPA) studies how much CPU and memory Pods really use and recommends, or applies, better resource sizes. This is scaling up and down, and it fixes the common mistake of guessing numbers once and never revisiting them.

Level 3: more or fewer machines

When Pods have nowhere to run, the cluster autoscaler adds nodes. When nodes sit mostly empty, it removes them. In Standard mode, node auto-provisioning can even create new node pools with suitable machine shapes by itself. In Autopilot, this whole level is handled by the platform.

AutoscalerWhat it changesReacts to
Horizontal Pod AutoscalerNumber of Pod copiesCPU, memory, custom or external metrics
Vertical Pod AutoscalerCPU and memory size of each PodObserved real usage
Cluster autoscalerNumber of nodes in a poolPods that cannot be scheduled, or idle nodes
Node auto-provisioningCreation of whole node poolsPod needs that no existing pool fits
Everyday analogy

Think of a supermarket. The HPA opens more checkout lanes when queues grow. The VPA is the manager who notices that cashiers are given tables far bigger than they need and adjusts the layout. The cluster autoscaler is the owner who rents extra floor space for a festival week and returns it afterwards.

How fast can it react?

Adding Pods is quick, often seconds. Adding a new machine takes longer, typically minutes, because a virtual machine must boot, join the cluster and pull images. If a traffic spike is sharp and predictable, such as a sale at noon, scale in advance, or keep a little spare headroom. Many teams run small placeholder Pods at low priority that are evicted instantly when real work arrives, so real Pods never wait for a new machine.

Performance habits that matter

  • Set requests and limits honestly. A request is the amount reserved for the Pod; a limit is the ceiling. Requests drive scheduling and, in Autopilot, billing.
  • Keep images small. Smaller images download faster, which speeds up scaling and recovery.
  • Spread work across zones. It avoids hotspots and improves resilience.
  • Mind CPU limits. Very tight CPU limits can cause throttling that looks like random slowness.
  • Test under load. Autoscaling rules should be proven by experiment, not hope.
i
Tip

Avoid pointing the HPA and the VPA at the same CPU or memory signal for the same workload. They can fight each other. A common safe approach is HPA on a business metric and VPA in recommendation-only mode.

!
Watch out

Autoscaling is limited by project quotas, address ranges and cloud capacity. A cluster that wants to grow but hits a quota will simply leave Pods pending. Check quotas ahead of big events.

Scale limits

A single GKE cluster can be very large. Google has demonstrated clusters of tens of thousands of nodes for demanding jobs such as AI training. For ordinary services, the practical limits are usually address ranges, quotas and how many objects the control plane must track. When one cluster is not enough, split by region, team or environment.

11High Availability and Reliability

High availability means staying up when parts fail. In the cloud, parts fail all the time, so the design must expect it.

Zones and regions

A region is a geographic area, such as Mumbai or Frankfurt. Inside it are several zones, which are separate data center groups with independent power and cooling. A zone can fail while the others keep working.

Zonal versus regional clusters

Regional cluster

  • Control plane runs in several zones, so API access and upgrades continue even if a zone fails.
  • Nodes can be spread over multiple zones.
  • Google offers a stronger availability commitment for it.
  • Recommended for production.

Zonal cluster

  • Control plane has a single replica in one zone.
  • Cluster management may be unavailable during upgrades or a zone outage, though running Pods usually continue.
  • Cheaper and simpler.
  • Suitable for development and test.
flowchart TB
  GLB["Global Load Balancer"] --> ZA
  GLB --> ZB
  GLB --> ZC
  subgraph REG["One region with a regional cluster"]
    CPX["Control plane replicas in three zones"]
    subgraph ZA["Zone A"]
      NA["Nodes with 2 Pods"]
    end
    subgraph ZB["Zone B"]
      NB["Nodes with 2 Pods"]
    end
    subgraph ZC["Zone C"]
      NC["Nodes with 2 Pods"]
    end
    CPX --- NA
    CPX --- NB
    CPX --- NC
  end
  NA --> DB["Regional managed database"]
  NB --> DB
  NC --> DB
    
Figure 5: A regional cluster spreads Pods across three zones, so the loss of one zone removes only a third of capacity.

Tools that keep Pods available

  • Replicas: never run just one copy of anything important.
  • Topology spread and anti-affinity rules: tell the scheduler to spread copies across zones and nodes instead of piling them in one place.
  • Pod disruption budgets (PDBs): a promise to the platform such as “at least two copies must stay up during voluntary maintenance”. Upgrades and drains respect it.
  • Probes: detect and sideline unhealthy Pods quickly.
  • Resource requests: ensure Pods are not crammed onto nodes without room to breathe.

Upgrades without downtime

Kubernetes releases new versions several times a year, and old versions stop being supported. GKE organizes this with release channels, called Rapid, Regular and Stable, which trade freshness for proven stability, plus an Extended option for longer support. You choose a channel, and Google upgrades the control plane and, if enabled, the nodes. You can set maintenance windows so upgrades happen at quiet hours, and maintenance exclusions to avoid them during a big sales period.

For node upgrades, GKE can use surge upgrades, which add a few extra nodes first and then replace old ones gradually, or blue-green upgrades, which build a full new set of nodes and move traffic over with a quick way back. Both rely on your PDBs and probes being correct to avoid interruptions.

Everyday analogy

Rolling upgrades are like repainting a long bridge one lane at a time: cars keep crossing while workers change one lane. A blue-green upgrade is like building a second bridge next to the first and switching the road signs over once it is ready.

Self-healing at the node level

Node auto-repair checks node health regularly. If a node keeps reporting failures, GKE drains it and recreates it. Combined with Pod-level restarts and Deployment controllers, this forms layers of healing: container, Pod, node.

Beyond one cluster

If a whole region is lost, even a regional cluster is gone. Businesses that cannot accept that run a second cluster in another region and steer traffic with a global load balancer or multi-cluster Gateway. This is more work and more cost, so match it to the real business need. Always pair it with tested backups and a written recovery plan.

!
Watch out

Redundancy that has never been tested is only a hope. Practice zone-failure drills in a test environment, and confirm that databases, queues and caches survive too, not only your stateless Pods.

12Security

Good cloud security is built in layers, so that one mistake does not become a disaster.

Everyday analogy

Think of a bank. There is a fence around the property, guards at the door, ID checks at the counter, locked drawers behind it, a vault for the most precious items, and cameras everywhere. No single lock is trusted alone. GKE security works the same way: many small controls stacked together.

Layer 1: who can do what (identity and access)

Two permission systems work together. Cloud IAM decides what a person or service may do to Google Cloud resources, such as creating clusters. Kubernetes RBAC (role-based access control) decides what they may do inside a cluster, such as reading Pods in one namespace. The golden rule is least privilege: give each person and program only the exact permissions they need, nothing more.

Layer 2: how Pods prove who they are

Your applications often need to call Google services, such as reading a storage bucket. The old way was to save a long-lived key file inside the cluster, which is risky because keys leak. The modern way is Workload Identity Federation for GKE. A Pod is linked to an identity, and Google Cloud issues short-lived credentials automatically, with no key files to copy or lose.

Layer 3: shrinking the attack surface

  • Private clusters keep nodes off the public internet.
  • Authorized networks limit which addresses may reach the control plane.
  • Shielded GKE nodes use verified boot and integrity checks to resist tampering.
  • Hardened node images with minimal software and automatic patches.
  • Network policies limit Pod-to-Pod conversations.

Layer 4: trusting only what you built

Many attacks arrive through software supply chains: a poisoned library or an altered image. Defenses include scanning images for known weaknesses in Artifact Registry, signing images that passed your pipeline, and using Binary Authorization so the cluster refuses to run any image that lacks a valid signature. Keep images small and based on minimal, trusted bases.

Layer 5: containing the damage

  • Pod Security Standards block risky settings, such as running as the all-powerful root user or asking for host-level access.
  • GKE Sandbox adds an extra isolation layer, based on gVisor, for running untrusted code.
  • Separate namespaces and node pools for sensitive workloads limit how far a break-in can spread.

Layer 6: protecting secrets and data

Kubernetes Secrets are encoded, not strongly protected by default. GKE can encrypt them at the application layer with keys you control in Cloud KMS, or you can keep secrets in Secret Manager and bring them into Pods when needed. Data on disks is encrypted by default, and you can choose to manage the keys yourself. Never place passwords inside images or source code.

Layer 7: seeing and responding

Turn on audit logging so every action against the API server is recorded. Use Google’s security posture and vulnerability reports to find misconfigurations, and send alerts for suspicious events such as a new administrator role or a Pod with powerful settings.

ThreatMain defenses
Stolen credentialsWorkload Identity Federation, short-lived tokens, least privilege, no key files
Malicious or vulnerable imageImage scanning, signing, Binary Authorization, minimal base images
One hacked Pod spreadingNetwork policies, namespaces, Pod Security Standards, sandboxing
Exposed management endpointPrivate clusters, authorized networks
Leaked secretsSecret Manager, KMS encryption, audit logs
Overly powerful accountsNarrow IAM and RBAC roles, regular reviews
!
Watch out

The most common real-world breaches are not clever hacks. They are exposed dashboards, over-broad permissions and leaked keys. Fixing the basics prevents most of the danger.

13Monitoring, Logging and Metrics

You cannot fix what you cannot see. Observability is the practice of making a running system explain itself.

The three kinds of signals

Numbers

Metrics

Counts and measurements over time, such as requests per second, error rate and memory use. Great for dashboards and alerts.

Text

Logs

Timestamped records of what happened, such as “payment failed for order 123”. Great for finding the cause of a specific problem.

Journeys

Traces

The path of a single request across many services, with timing at each step. Great for finding which hop is slow.

Everyday analogy

Think of a car. Metrics are the dashboard gauges: speed, fuel, engine temperature. Logs are the diary of events, like “door opened” or “check engine light on at 3 pm”. Traces are a GPS recording of one trip that shows exactly where you got stuck in traffic.

What GKE gives you

  • Cloud Logging: collects container output and cluster events automatically, so a program that simply prints messages already has searchable logs.
  • Cloud Monitoring: gathers system metrics for nodes, Pods and containers, with ready-made GKE dashboards, uptime checks and alerting.
  • Managed Service for Prometheus: Prometheus is the popular open-source metrics system in the Kubernetes world. Google offers a managed version, so you can collect and query Prometheus-style metrics without running the storage yourself.
  • Cloud Trace: follows requests across services when your programs are set up to send trace data.
  • Audit logs: record who changed what in the cluster.

What to watch

A helpful method is to watch four things for every service, often called the golden signals:

  • Latency: how long requests take, especially the slowest few percent.
  • Traffic: how many requests arrive.
  • Errors: what share of requests fail.
  • Saturation: how full the resources are, such as CPU, memory and connection pools.

For the cluster itself, also watch Pods stuck in Pending, containers restarting repeatedly, nodes under memory pressure, unused or exhausted address space, and upgrade events.

Alerts that people can act on

Alert on symptoms users feel, such as high error rate or slow checkout, rather than on every internal blip. Too many noisy alerts train people to ignore them. Each alert should say what is wrong, how serious it is, and where to look first. Link it to a short runbook, which is a written list of steps for handling that situation.

i
Tip

Write logs as structured records with fields such as request ID and user region, not free-form sentences. Structured logs are far easier to search and to connect to traces.

!
Watch out

Logging everything at the most detailed level can produce a surprisingly large bill and slow searches. Decide what is worth keeping, and for how long.

14Deployment and CI/CD

Deployment is how new code reaches users. Good pipelines make it boring, frequent and safe.

The pipeline in plain words

CI (continuous integration) means every code change is automatically built and tested. CD (continuous delivery or deployment) means a tested change is automatically released through stages, such as test, staging and production. On Google Cloud, a typical flow looks like this:

flowchart LR
  DEV["Developer pushes code"] --> REPO["Source repository"]
  REPO --> BUILD["Cloud Build: build and test"]
  BUILD --> SCAN["Image scan and signing"]
  SCAN --> AR["Artifact Registry"]
  AR --> DEPLOY["Cloud Deploy or GitOps tool"]
  DEPLOY --> STG["Staging cluster"]
  STG --> GATE{"Tests and approval pass?"}
  GATE -- "Yes" --> PROD["Production cluster"]
  GATE -- "No" --> STOP["Stop and notify team"]
  PROD --> OBS["Monitoring and alerts"]
  OBS --> ROLLBACK{"Healthy?"}
  ROLLBACK -- "No" --> RB["Automatic rollback"]
    
Figure 6: A simple, safe delivery pipeline from code to production on GKE.

Release strategies

StrategyHow it worksBest forRisk
Rolling updateReplace Pods gradually, a few at a timeDefault for most servicesOld and new versions run side by side for a while
Blue-greenRun a full new copy, then switch traffic all at onceInstant rollback needsNeeds double capacity briefly
CanarySend a small share of users to the new version, then growHigh-risk changesNeeds good monitoring to judge the canary
RecreateStop old, start newRare, simple batch toolsCauses downtime
Everyday analogy

A canary release is like testing a new recipe on a few diners before changing the whole restaurant menu. If the first few tables like it, you serve it to more tables. If they send it back, you pull it and nobody else is disappointed.

GitOps: the repository is the truth

In GitOps, the desired state of the cluster is stored in a version-controlled repository. A tool inside the cluster, such as Config Sync or Argo CD, continuously compares the repository with reality and fixes any drift. Changes happen through reviewed pull requests. This gives you history, approvals, easy rollbacks, and a clear answer to “who changed this and when?”.

Packaging tools

Real applications need many Kubernetes objects at once. Tools such as Helm and Kustomize bundle these objects and let you vary settings between environments. Teams pick one approach and stay consistent.

Safe rollout checklist

  • Use image tags that never change meaning, such as a version number or a unique build ID, instead of a floating label like “latest”.
  • Define readiness probes and Pod disruption budgets before the first production release.
  • Use database changes that work with both the old and the new version of the code.
  • Automate a rollback trigger tied to error-rate alerts.
  • Keep staging as close to production as you can afford.
i
Tip

Smaller, more frequent releases are safer than big, rare ones. When something breaks, a small change makes the cause obvious and the fix quick.

15Advantages, Disadvantages and Trade-offs

No tool is perfect. A good architect knows both what GKE gives and what it costs.

Advantages

  • Google runs the hardest part, the control plane, and keeps it patched and available.
  • Strong self-healing and autoscaling across Pods and machines.
  • Deep integration with Google networking, load balancing, identity, logging and security.
  • Standard Kubernetes, so skills and tools are portable and the community is huge.
  • Handles very large scale and demanding workloads, including GPUs and TPUs for AI.
  • Autopilot offers a hands-off option that lowers operational burden.
  • Release channels give a predictable upgrade path.

Disadvantages

  • Kubernetes has a steep learning curve and many moving parts.
  • Overkill for a tiny app with a handful of users.
  • Costs can drift upward through idle capacity and oversized requests.
  • Platform features tie you to Google Cloud even though the core is portable.
  • Forced version upgrades require regular attention to deprecated features.
  • Misconfiguration, not the platform, is the usual cause of outages and breaches.
  • Autopilot limits some low-level tuning.

GKE versus other ways to run code

OptionControlOperational workGood fit
Virtual machines you manage yourselfMaximumHighLegacy software, special needs
Self-managed KubernetesMaximumVery highStrict data center or sovereignty requirements
GKE StandardHighMediumPlatform teams who need node-level choice
GKE AutopilotMediumLowMost container workloads
Cloud RunLowVery lowSimple stateless services and event-driven jobs

The honest decision guide

If your application is a single small service, Cloud Run or a similar serverless option is often simpler and cheaper. Choose GKE when you run many services that must talk to each other, need fine control over networking and scheduling, run long-lived or stateful workloads, need special hardware, or want one standard platform for many teams. The strongest reason to pick Kubernetes is not that it is fashionable, but that you truly need what it does.

Everyday analogy

Choosing between Cloud Run and GKE is like choosing between taking a taxi and owning a fleet of vehicles. A taxi is perfect for occasional trips. A fleet makes sense when many drivers need many different vehicles every day and you want to control routes, maintenance and costs yourself.

i
Trade-off to remember

You are trading simplicity for power. Every extra feature in Kubernetes is something your team must understand, configure and secure.

16Cost and Pricing Basics

Cloud bills grow quietly. Understanding where the money goes is the first step to keeping it sensible.

What you pay for

  • Cluster management fee: a small hourly fee per cluster, with a monthly free-tier credit applied per billing account. Check the current pricing page for exact figures, as they can change.
  • Compute: in Standard, the virtual machines in your node pools. In Autopilot, the CPU, memory and storage requested by your Pods.
  • Storage: disks, file shares and snapshots.
  • Networking: load balancers, and data leaving a zone, a region or Google Cloud. Traffic between zones can cost money, which surprises many teams.
  • Observability: log ingestion and metric storage beyond free allowances.

Where waste hides

Idle

Empty capacity

Nodes running at 20 percent use still bill at 100 percent in Standard mode.

Guesswork

Oversized requests

Pods that ask for four times what they need block space and inflate Autopilot bills.

Forgotten

Abandoned resources

Old test clusters, unattached disks and unused load balancers keep billing.

Chatty

Cross-zone traffic

Services spread across zones that talk constantly generate network charges.

Ways to spend less

  • Right-size requests using real usage data and the Vertical Pod Autoscaler recommendations.
  • Use Spot VMs for fault-tolerant work such as batch jobs. Spot machines are much cheaper but can be taken back by Google with short notice, so the workload must tolerate interruption.
  • Commit for steady load. Committed use discounts reward predictable baseline usage with lower prices.
  • Scale to zero or small in non-production environments at night and on weekends.
  • Pack nodes well in Standard by picking machine shapes that match your Pods.
  • Label everything by team and product, and turn on cost allocation so each team sees its own share.
  • Review regularly. Budgets and alerts catch surprises early.
Everyday analogy

Running a cluster is like running a taxi company. Empty taxis waste fuel and driver pay, too many taxis for a quiet Tuesday means losses, and discounts on long-term vehicle leases reward steady demand. Spot VMs are like borrowing extra cars that the owner may reclaim at short notice, perfect for deliveries that can wait.

!
Watch out

Cost cutting that harms reliability is a false saving. Do not run production on Spot-only capacity without tested interruption handling, and do not remove headroom that protects you during traffic spikes.

17Scheduling and Resource Management in Depth

Where a Pod lands, and how much room it gets, decides both its performance and your bill. This chapter goes one level deeper than the basics.

Requests and limits, once more with feeling

Every container can declare two numbers for CPU and for memory. The request is the amount the scheduler reserves: it will only place the Pod on a node that still has that much unreserved room. The limit is the ceiling the container may not exceed. CPU is a squeezable resource: a container that hits its CPU limit is slowed down, or throttled. Memory is not squeezable: a container that goes beyond its memory limit is killed, and you will see the reason reported as “out of memory”.

Everyday analogy

Booking a hotel room is a request: the hotel holds the room for you whether or not you use it. A limit is the house rule that you may not bring more than four guests. If you break a rule about noise (CPU), the hotel just asks you to quiet down. If you break a rule about fire safety (memory), you are asked to leave.

Quality of service classes

Kubernetes sorts Pods into three classes, which decide who is sacrificed first when a node runs short of memory.

ClassHow you get itWhen the node is under pressure
GuaranteedRequests equal limits for every containerProtected; removed last
BurstableSome request set, but lower than the limitIn the middle
BestEffortNo requests or limits at allRemoved first

For important production services, many teams aim for requests equal to limits on memory, and a request somewhat below the limit on CPU. This avoids surprise kills while still allowing short bursts of speed.

Steering Pods with rules

Attract

Node affinity

“Prefer or require nodes with this label”, for example nodes that have a fast disk or a particular machine family.

Repel

Taints and tolerations

A taint marks a node as “keep out unless you have a matching pass”. A toleration is that pass. Used to reserve special nodes, such as GPU nodes, for the right Pods.

Group

Pod affinity

Place Pods near other Pods, such as a cache next to the app that uses it, to reduce delay.

Separate

Pod anti-affinity and spread

Keep copies of one service on different nodes and in different zones so one failure never takes them all.

Everyday analogy

Think of seating guests at a wedding. Affinity is “seat the cousins together”. Anti-affinity is “do not seat the two rival uncles at the same table”. A taint is a reserved table with a sign that says “family only”, and the toleration is the family badge.

Priority and preemption

Not all Pods are equally important. A priority class gives each Pod a rank. If a high-priority Pod cannot find room, the scheduler may evict lower-priority Pods to make space. This is how the “placeholder Pod” trick from the scaling chapter works: low-priority dummy Pods hold spare room and are pushed out the moment real work needs it.

Keeping teams fair: quotas and limit ranges

In a shared cluster, one careless team could grab all the capacity. A ResourceQuota caps the total CPU, memory, storage or number of objects a namespace may use. A LimitRange sets default and maximum sizes for individual Pods or containers, so a forgotten setting does not become a huge one. Together they act like a household budget plus a rule that no single purchase may exceed a set amount.

Bin packing and why it matters

Putting Pods onto nodes is a packing puzzle. If Pods are too large relative to nodes, you leave awkward gaps that no Pod can fill. If they are too tiny, you waste effort. In Standard mode, choose node sizes that fit several Pods snugly. In Autopilot, the platform packs for you, which is one reason many teams find it easier.

i
Tip

When a Pod is stuck in Pending, ask the cluster why. The event messages usually say plainly whether the cause is not enough CPU, not enough memory, a taint with no toleration, or an affinity rule that cannot be met.

18Advanced Topic: Multi-Cluster, Fleets and GKE Enterprise

A single cluster is a great start. Large organizations eventually run many, and they need ways to manage them as one family.

Why more than one cluster?

  • Resilience: a second region protects against the loss of a whole region.
  • Proximity: clusters near users reduce delay.
  • Isolation: separate clusters for production, testing, and sensitive workloads limit the blast radius of mistakes.
  • Regulation: some data must stay in a specific country, so a cluster must live there.
  • Team autonomy: big organizations give each business unit its own cluster.

Fleets: treating clusters as a group

A fleet is a logical group of clusters that you manage together. Registering clusters into a fleet unlocks shared features: one place to see health, shared identity concepts across clusters, consistent configuration pushed from a repository, and policy applied everywhere at once. The enterprise edition of GKE builds on this idea with additional governance, security and multi-cluster tools aimed at larger organizations, and it can also extend to clusters outside Google Cloud. Check Google’s documentation for the current feature list, since packaging evolves.

Multi-cluster networking

Two helpful features are multi-cluster Services, which let a Service in one cluster be discovered and used from another, and multi-cluster Gateway, which lets one global load balancer spread user traffic across clusters in different regions. If a region has trouble, traffic shifts to the healthy clusters.

flowchart TB
  USERS["Users worldwide"] --> GLB["Global load balancer with multi-cluster Gateway"]
  GLB --> C1
  GLB --> C2
  subgraph FLEET["One fleet"]
    subgraph C1["Cluster in Region 1"]
      A1["Pods in three zones"]
    end
    subgraph C2["Cluster in Region 2"]
      A2["Pods in three zones"]
    end
  end
  REPO["Git repository with shared configuration"] --> C1
  REPO --> C2
  POL["Fleet-wide policy"] --> C1
  POL --> C2
  A1 --> DB["Multi-region database"]
  A2 --> DB
    
Figure 7: Two clusters in different regions, managed as one fleet, with traffic shared by a global load balancer.
Everyday analogy

A single cluster is one branch of a restaurant. A fleet is a restaurant chain: each branch runs on its own, but the head office sets the menu, hygiene rules and branding, and a booking system sends customers to the nearest branch with free tables.

The hard part is data

Stateless Pods are easy to run in two regions. Data is not. Keeping two regions in step requires either a database built for multiple regions, or a careful plan for which region owns which data. Decide early whether you need active-active (both regions serve users) or active-passive (one region waits as a standby), because the cost and complexity differ greatly.

!
Watch out

More clusters mean more upgrades, more policies and more cost. Do not split into many clusters without a reason you can write down in one sentence.

19Advanced Topic: AI, Machine Learning and Batch Workloads

GKE is not only for web services. It is also a popular home for training and serving machine learning models and for large batch jobs.

Why these workloads are different

Web services run forever and respond to requests. Batch jobs start, do a big piece of work, and finish. Machine learning adds expensive special hardware: GPUs (graphics processors, very good at the math used in AI) and TPUs (Google’s own chips designed for AI). Because this hardware costs a lot, the goal is to keep it busy and to release it immediately when work ends.

The building blocks

Hardware

Accelerator node pools

Pools of machines with GPUs or TPUs attached, tainted so that only AI workloads land on them.

Run to completion

Jobs and CronJobs

A Job runs Pods until the work is done. A CronJob runs a Job on a schedule, such as every night.

Fair sharing

Queueing systems

Queue managers such as Kueue admit jobs only when enough hardware is free and share it fairly among teams.

Sharing

GPU sharing

Several small workloads can share one GPU through time-slicing or partitioning, so a small job does not hold a whole expensive card.

Serving

Model serving

Trained models are served behind Services and Gateways, and autoscaled on request rate or queue depth, just like web services.

Savings

Spot capacity

Training jobs that save checkpoints can use cheaper Spot machines and simply resume if interrupted.

Everyday analogy

Think of a printing shop with a few giant, costly machines. You do not leave them idle, and you do not let one customer hog them all day. A booking desk (the queue) lines up jobs, each job uses the machine until finished, and the machine is then handed to the next customer.

Checkpoints: the secret to cheap training

A long training job may run for days. If a machine fails or a Spot machine is taken back, you do not want to start from zero. A checkpoint is a saved snapshot of the job’s progress, written to durable storage every so often. After an interruption, a new Pod loads the latest checkpoint and carries on. This one habit turns unreliable cheap machines into a dependable, affordable fleet.

Feeding the hardware

An idle GPU waiting for data is wasted money. Training data should live in fast storage close to the cluster: Cloud Storage with a mounting driver for large datasets, or a shared file system for many readers. Watch GPU utilization in your dashboards, and treat low numbers as a sign of a data or network bottleneck rather than of a hardware shortage.

Large-scale jobs

Some jobs span hundreds or thousands of machines that must work together and talk very fast. These need careful placement, with machines close to each other on the network, and a scheduler that starts all the Pods together or not at all. Teams call this gang scheduling. It is a specialist topic, but it shows why GKE can host such heavy work: its scheduler and networking can be tuned for it.

i
Tip

Before buying or reserving large amounts of accelerator capacity, check availability in your chosen region and plan quotas early. Special hardware is often limited and can take time to obtain.

20Governance, Policy and Compliance

When dozens of teams share a platform, good intentions are not enough. You need automatic rules that say what is allowed.

Policy as code

A policy is a rule such as “every Pod must declare resource requests”, “images must come from our trusted registry”, or “no Service may expose a public load balancer without approval”. With admission control, the API server checks each new object against such rules before saving it, and rejects those that fail. Tools such as Policy Controller, built on the open-source Gatekeeper and Open Policy Agent, let you write these rules once and apply them across clusters.

Everyday analogy

Admission control is the building inspector who checks plans before construction starts. It is far cheaper to reject a plan with no fire exits on paper than to demolish the finished building.

Layers of guardrails

LayerExample ruleWhere it applies
Organization policyBlock creation of clusters with public nodesAcross Google Cloud projects
Pod security standardsDisallow privileged containers and root usersInside the cluster, per namespace
Admission policiesRequire labels, resource requests and trusted image sourcesInside the cluster, per object
Pipeline checksScan images and configuration files before releaseBefore anything reaches the cluster
QuotasCap each team’s resource usagePer namespace

Compliance basics

Industries such as finance, health and government must prove they follow rules about data protection, access control and record keeping. GKE helps by supporting encryption with customer-managed keys, detailed audit logs, region choice for data residency, and security posture reports. But compliance is a shared job: Google certifies its platform, and you must show that your own configuration and processes meet the standard. Keep written records of who approved what, and keep your policies in version control so auditors can see their history.

Labels and ownership

Every cluster, namespace and workload should carry labels for owner, product, environment and cost center. These small tags power cost reports, incident routing and policy rules. A resource nobody owns is a resource nobody fixes.

!
Watch out

Policies introduced suddenly can break working applications. Start in audit or warning mode, share the findings with teams, give them time to fix issues, and only then switch to enforcement.

21Day-Two Operations and Troubleshooting

Launching a cluster is the easy day. Keeping it healthy for years is the real job, often called day-two operations.

A symptom-first troubleshooting table

Most problems fall into a few families. Start with the symptom, then check the most likely causes in order.

SymptomLikely causesFirst things to check
Pod stuck in PendingNot enough CPU or memory, taint without toleration, volume in wrong zone, quota reachedThe Pod’s event messages, node capacity, quotas
Image pull failureWrong image name or tag, no permission to the registry, no outbound route from private nodesEvent messages, registry permissions, Cloud NAT
Container restarts again and againProgram crashes at start, failing liveness probe, out-of-memory killPrevious container logs, memory limit, probe settings
Pod running but no trafficReadiness probe failing, Service label mismatch, network policy blockingService endpoints, probe results, policy rules
Random slownessCPU throttling, noisy neighbor, slow dependency, cross-zone chatterCPU throttling metrics, traces, node pressure
Errors during releasesMissing readiness probes, no graceful shutdown, no spare replicasProbe design, termination grace period, disruption budgets
Cluster cannot growQuota, address range, or zone capacity limitQuota pages, autoscaler events, address usage
Everyday analogy

Troubleshooting is like a doctor visit. You describe the symptom, the doctor checks vital signs (metrics), reads your history (logs and events), and works from the most common causes to the rare ones. Guessing wildly or treating without looking is how patients get worse.

Service level objectives

A service level objective (SLO) is a promise about quality, such as “99.9 percent of requests succeed over a month”. The gap between perfect and the promise is the error budget. If you are spending the budget slowly, you can ship faster. If it is nearly gone, you slow down and fix reliability. SLOs turn arguments about “is the service good enough?” into measurable answers, and they tell you which alerts truly matter.

Incident habits that work

1

Stabilize first

Roll back the last change, add capacity, or shift traffic. Understanding comes after users are safe.

2

Communicate clearly

One person leads, another writes the timeline, and stakeholders get regular short updates.

3

Find the cause with evidence

Use metrics, logs, traces and change history rather than hunches.

4

Write a blameless review

Describe what happened and what to improve in systems and processes, without pointing fingers at people.

5

Turn lessons into changes

Add the missing alert, fix the runbook, add the guardrail, and verify it works in a drill.

Routine chores

  • Review upgrade notices and deprecated features each month.
  • Check certificates, secrets and keys that expire.
  • Prune unused images, disks, clusters and load balancers.
  • Run a restore test of backups on a schedule.
  • Revisit access lists, removing people who have moved on.
i
Tip

Keep a short, living runbook for each service: who owns it, how to check it, how to roll back, and who to call. The best time to write it is right after the last incident, while the details are fresh.

22Migrating to GKE: A Practical Path

Most teams do not start from a blank page. They have existing applications on servers or virtual machines. Here is a sensible way to move.

Everyday analogy

Migrating is like moving house. You would not pack the entire home in one night. You survey what you own, decide what to keep, move room by room, and keep the old house for a while in case something was left behind.

1

Assess and sort

List applications, their dependencies, data, traffic and owners. Sort them by how well they suit containers. Stateless web services are easy; tightly bound legacy systems are hard.

2

Build the landing zone

Create the network, identity setup, policies, logging, and a first cluster with sensible defaults, before any application moves in.

3

Containerize a pilot

Choose one low-risk application. Package it into an image, externalize configuration, add probes, and write its deployment description. Learn from the experience.

4

Build the pipeline

Automate build, scan, test and deploy for the pilot so every later application reuses the same path.

5

Shift traffic gradually

Run old and new side by side and move a small percentage of users first. Watch errors and speed before moving more.

6

Migrate in waves

Move applications in groups, easiest first, applying lessons from each wave.

7

Retire the old world

Only after a stable period, decommission old servers, and update documentation and runbooks.

Three common migration styles

Fast

Lift and shift

Package the application mostly as it is. Quick, but you inherit old limitations and may waste resources.

Balanced

Improve while moving

Make modest changes, such as externalizing settings and adding health checks, so the app behaves well on Kubernetes.

Gradual

Strangler approach

Build new features as small services on GKE and slowly peel pieces off the old system until little remains.

Pitfalls to expect

  • Hidden dependencies: applications that rely on fixed IP addresses, local files or specific server names.
  • State on disk: data written to the machine’s local disk that must move to proper storage.
  • Skills gap: teams need training time. Budget for it, and appoint platform champions.
  • Too many services too soon: splitting an application into dozens of microservices at the same moment as migrating doubles the risk. Move first, split later if needed.
  • Network latency to old systems: parts left behind on premises may now be farther away. Measure before and after.
i
Remember

A migration succeeds when users notice nothing and engineers notice improvement. Keep a clear way back until the new platform has proved itself.

23Design Patterns and Anti-patterns

A pattern is a proven solution to a common problem. An anti-pattern is a popular mistake that looks reasonable but causes pain.

Patterns worth knowing

Pattern

Sidecar

A helper container sits beside the main one in the same Pod, handling chores like log shipping, secure connections or configuration refresh, so the main program stays simple.

Pattern

Init container

A short-lived container that runs before the main one, for tasks such as waiting for a dependency or preparing files.

Pattern

Stateless front, managed data

Keep web and worker Pods stateless on GKE and put data in managed databases, caches and queues.

Pattern

Namespace per team or environment

Separate wings of the cluster with their own access rules, quotas and network policies.

Pattern

Queue-based workers

Jobs wait in a queue and a pool of worker Pods scales with the queue length, smoothing out spikes.

Pattern

Circuit breaker and retries

Applications stop calling a failing dependency for a moment, and retry gently with delays, so one sick service does not drag down all others.

Pattern

Cluster per environment or region

Strong separation between production and non-production, or between regions, limits the blast radius of mistakes.

Pattern

Immutable infrastructure

Never patch a running Pod by hand. Build a new image, test it, and replace the old one.

Anti-patterns to avoid

ANTI-PATTERN 01Avoid
What it looks like

Everything runs in one big shared namespace with the default permissions, and anyone on the team has cluster-wide administrator rights.

Why it hurts

One mistaken command can delete another team’s work, and one stolen account becomes a master key to the entire cluster.

Better approach

Use namespaces, narrow RBAC roles, quotas and network policies. Give administrator rights to very few people and review them regularly.

ANTI-PATTERN 02Avoid
What it looks like

Pods are launched without resource requests or limits, and without probes, because “it works on my laptop”.

Why it hurts

The scheduler cannot place Pods wisely, noisy neighbors starve each other, and traffic reaches Pods that are not ready. Failures look random.

Better approach

Always set honest requests, sensible limits, and all three probes where they apply. Enforce this with policy checks in the pipeline.

ANTI-PATTERN 03Avoid
What it looks like

Treating Pods like pets: logging in to a running Pod to edit files, keeping important data on its local disk, or relying on a specific Pod name.

Why it hurts

The next restart erases the fix and the data. The system becomes impossible to reproduce or scale.

Better approach

Change the image or the configuration, redeploy, and keep state in proper persistent or managed storage.

ANTI-PATTERN 04Avoid
What it looks like

Using a floating image label such as “latest”, and keeping a single giant cluster for every purpose, including experiments.

Why it hurts

Nobody can tell which version is running or reproduce a bug, and a failed experiment can disrupt production.

Better approach

Pin images to exact versions or content digests, and keep production separate from experiments.

24Best Practices and Common Mistakes

If you remember only one chapter for real-world work, make it this one.

A practical order of work for a new production cluster

1

Choose the mode and shape

Start with Autopilot unless you can name a clear reason for Standard. Use a regional cluster for production.

2

Plan the network

Size Pod and Service ranges generously. Use a private cluster and authorized networks where possible.

3

Lock down identity

Enable Workload Identity Federation, create narrow roles, and avoid key files completely.

4

Pick a release channel and windows

Choose Regular or Stable for production, set maintenance windows, and test upgrades in a lower environment first.

5

Set guardrails

Apply Pod security rules, network policies, resource quotas and policy checks so unsafe workloads cannot even start.

6

Observe from day one

Dashboards, alerts and runbooks should exist before the first user arrives.

7

Automate delivery

Build a pipeline with scanning, signing, staged rollouts and an automatic rollback.

8

Rehearse failure

Drain a node, kill a zone’s worth of Pods in a test cluster, restore a backup. Learn how it breaks while nobody is watching.

Common mistakes beginners make

  • Starting with too much. Adopting every Kubernetes add-on on day one. Begin simple and add features when a real need appears.
  • Ignoring requests and limits. This causes both outages and overspending.
  • Exposing services accidentally. A LoadBalancer Service creates a real, public entrance unless you ask for an internal one.
  • Running as root. Many images default to it. Switch to an unprivileged user.
  • Skipping upgrades. Falling many versions behind forces risky big-bang upgrades and may leave you on unsupported software.
  • One replica of everything. It makes every update a mini-outage.
  • Forgetting about quotas and addresses. The cluster cannot grow beyond them.
  • Storing secrets in source code. Anyone with repository access gets the keys.
  • No cost visibility. Without labels and budgets, nobody owns the bill.
  • Debugging by hand in production. Manual fixes disappear on the next deployment and hide the real cause.
i
Tip

When a Pod misbehaves, three questions solve most problems: What does the Pod’s event history say? What do its logs say? Is it simply unable to find room, pull its image, or pass its probes?

25Real-World Usage Patterns

Here is how well-known kinds of organizations use GKE, based on publicly shared stories and common industry practice.

Gaming: surviving a surprise launch

Niantic, the maker of Pokémon GO, has publicly described running the game’s backend on GKE. The lesson is elasticity: when demand exceeds every forecast, the ability to add Pods and machines quickly, and to spread load across regions, can be the difference between a joyful launch and an outage.

Music streaming: many teams, one platform

Spotify has publicly shared its move of backend services to Google Cloud and Kubernetes. The point for architects is organizational as much as technical: a standard platform lets hundreds of small teams ship their own services using the same tools for deployment, scaling and monitoring.

Online retail: predictable spikes

Retailers face sale days and holiday peaks. A typical GKE design combines regional clusters, horizontal autoscaling on request rate, spare headroom before big events, a CDN for static content, and managed databases with read replicas. The platform scales stateless parts while the data layer is carefully prepared in advance.

Banking and payments: security first

Financial companies tend to choose private clusters, tight network policies, Binary Authorization, customer-managed encryption keys and detailed audit logs. They accept extra effort to meet regulatory rules, and they often run multiple regions for disaster recovery.

Machine learning: expensive hardware, shared well

Teams training and serving AI models use GKE to share pools of GPUs and TPUs among many jobs, queue work fairly, and release the costly hardware as soon as jobs finish. The scheduler becomes a tool for keeping very expensive machines busy.

Ride and delivery apps: real-time and regional

Apps that match drivers and riders need low delay and strong regional isolation. A common approach is one cluster per region, a global entry point, event streams for location updates, and autoscaling driven by queue depth and request rate.

The best GKE designs are rarely clever. They are simple, boring and well observed.

26Frequently Asked Questions

Q1Is GKE the same as Kubernetes?
No. Kubernetes is the open-source software. GKE is Google’s managed service that runs Kubernetes for you and connects it to Google Cloud features. The Kubernetes you use in GKE follows the same standard as everywhere else.
Q2Should a beginner choose Autopilot or Standard?
Autopilot is the gentler start for most application teams because it removes machine management and applies strong defaults. Choose Standard when you can name a need for node-level control, special machine types, or settings that Autopilot restricts.
Q3What is the difference between a Pod, a node and a cluster?
A Pod is a running unit holding your containers. A node is a machine that runs many Pods. A cluster is the whole group of nodes plus the control plane that manages them.
Q4Who manages the control plane in GKE?
Google does. It operates, patches, scales and repairs the control plane, and it keeps it running in its own managed environment. You interact with it through the API but never log in to its machines.
Q5Do I need a regional cluster?
For production workloads that must survive a zone failure, yes, a regional cluster is the recommended choice. For learning, development and testing, a zonal cluster is simpler and cheaper.
Q6How does GKE know a Pod is healthy?
Through probes. Readiness probes decide whether a Pod receives traffic, liveness probes decide whether a stuck container should be restarted, and startup probes give slow programs time to start. You must define them for good behavior.
Q7Can I run databases on GKE?
Yes, using StatefulSets and persistent disks, and many teams do. Still, managed database services take on backups, failover and patching for you, so they are often the safer default unless you have a specific reason to self-host.
Q8How do I stop paying for idle capacity?
Right-size Pod requests, use autoscaling at every level, consider Autopilot’s usage-based billing, use Spot VMs for interruptible work, shut down non-production environments when idle, and review cost reports by team and label.
Q9Why should I avoid service account key files?
Keys are long-lived and easy to copy or leak. Workload Identity Federation for GKE gives Pods short-lived credentials automatically, with no secret file to protect or rotate.
Q10What happens to my apps during a GKE upgrade?
Control plane upgrades are managed by Google, and on regional clusters the API stays available. Node upgrades replace nodes gradually and drain Pods politely. With multiple replicas, readiness probes and Pod disruption budgets, users usually notice nothing.
Q11Is GKE only for big companies?
No, but it is not always the right tool. For a single small service, a simpler serverless option may be better. GKE becomes attractive as the number of services, teams and requirements grows.
Q12What if I outgrow one cluster?
Run several clusters, by region, team or environment, and manage them together using fleet features, multi-cluster Services and Gateways, and GitOps. Many large organizations do exactly this.

27Summary and Key Takeaways

GKE takes the hardest part of Kubernetes, running the brain of the cluster, and hands it to Google, so that your team can spend its energy on the applications that earn money. You describe what you want, and layers of control loops make it true and keep it true: Pods restart, nodes heal, traffic shifts, and capacity grows and shrinks. The platform is powerful, but it rewards discipline. Clear requests, honest probes, tight permissions, tested recovery and steady cost reviews separate calm production clusters from stressful ones.

Key Takeaways

  • GKE is managed Kubernetes. Google runs the control plane; you run your workloads, in Autopilot or Standard mode.
  • Think desired state. You declare what you want, and reconciliation loops keep reality matching it, which is how self-healing and scaling work.
  • Pods are disposable. Use Services for stable addresses, keep Pods stateless, and put state in persistent or managed storage.
  • Design for failure. Use regional clusters, several replicas, spread rules, probes, disruption budgets and release channels with tested upgrades.
  • Layer your security. Least-privilege access, Workload Identity Federation, private clusters, network policies, trusted images and audited changes.
  • Watch and measure. Track the golden signals, alert on user-facing symptoms, and attach runbooks to alerts.
  • Control the bill. Right-size requests, use the right autoscalers, choose Spot and commitments wisely, and label for cost ownership.