Google Cloud · Comparison
Cloud Run vs GKE vs Compute Engine
Where should I run my application on Google Cloud: serverless containers, Kubernetes or virtual machines?
Decision summary
Start with Cloud Run for stateless HTTP services, event handlers and jobs: no clusters or servers, scaling to zero, per-use billing.
Choose GKE when you run many services that benefit from Kubernetes (shared platform tooling, StatefulSets, DaemonSets, custom networking or scheduling, portability). Prefer Autopilot unless you need node-level control.
Choose Compute Engine for software that needs a full operating system, special licensing or kernels, or for steady heavy workloads where VMs with committed use discounts are cheapest.
Best fit for each option
Cloud Run
Stateless web apps, APIs, webhooks, event handlers and batch jobs with variable traffic.
GKE
Platforms running many containerised services, stateful or long-running workloads, and teams using Kubernetes tooling.
Compute Engine
Lift-and-shift applications, specific OS or licensing needs, and steady heavy compute with committed discounts.
Side by side
| Cloud Run | GKE | Compute Engine | |
|---|---|---|---|
| Best for | Stateless services, events, jobs | Container platforms, complex microservices | Full VMs, legacy and special software |
| Scaling | Per request, automatic, to zero | HPA/VPA plus node autoscaling (automatic in Autopilot) | Managed instance group autoscaler |
| Operational complexity | Lowest: no servers or clusters | Medium: Kubernetes objects; nodes too in Standard | Highest: OS patching, images, instance groups |
| Cost | Per use (or per instance); idle can be near zero | Per Pod requests (Autopilot) or nodes, plus cluster fee | Per VM second; cheapest for steady load with discounts |
| Security | Sandboxed instances, attached service account, IAM invoker | Workload Identity, RBAC, network policies, Pod security | Shielded VMs, OS Login, you patch the OS |
| Availability | Regional across zones by default | Regional clusters across zones | Regional managed instance groups across zones |
When to avoid each option
Cloud Run
- Workloads that need Kubernetes APIs, privileged containers or node access.
- Requests longer than the maximum timeout.
GKE
- A few simple stateless services, where cluster operations add little.
- Teams without Kubernetes skills.
Compute Engine
- Stateless services you could run as containers without patching servers.
- Single VMs without managed instance groups in production.
Example scenarios
| Situation | Choose | Why |
|---|---|---|
| A REST API with traffic only during office hours | Cloud Run | Scales to zero outside office hours and needs no cluster. |
| Forty microservices with Helm charts and GitOps | GKE (Autopilot) | A shared Kubernetes platform fits the tooling and scale. |
| A licensed Windows application with a GUI installer | Compute Engine | It needs a full VM with a specific OS. |
| A nightly data export that runs for 20 minutes | Cloud Run jobs | Run-to-completion containers without servers. |
Exam cues
- Least management for containers: Cloud Run. Kubernetes required: GKE (Autopilot for least operations).
- Specific OS, licences or lift-and-shift: Compute Engine.
Service pages
- Cloud Run · Run containers without managing servers: request-driven services and run-to-completion jobs that scale automatically, down to zero.
- Google Kubernetes Engine (GKE) · Managed Kubernetes: Google runs the control plane, and in Autopilot mode the nodes too, so you deploy and pay for Pods.
- Compute Engine · Virtual machines on Google's infrastructure, from small shared-core VMs to GPU and memory-optimised machines, billed per second.
Related
Courses and lessons
- Cloud Run Scaled; the Database Didn't · Google Cloud in Production · Members
- The Upgrade That Took Down Checkout · Google Cloud in Production · Members
Services, comparisons and patterns
- Cloud Run · Service
- Google Kubernetes Engine (GKE) · Service
- Compute Engine · Service
- Cloud Run functions · Service
Sources
Independent study material, not affiliated with or endorsed by Amazon Web Services.