Cloud Run vs GKE vs Compute Engine: When to Use Each in Google Cloud
You need to pick a compute service. Cloud Run, GKE, and Compute Engine each solve different problems. This page gives you the decision framework, a side-by-side comparison, and scenario-based recommendations so you can choose quickly and confidently.
Quick answer
- Cloud Run is the default for stateless HTTP services, event-driven workloads, and scheduled jobs. Start here unless you have a reason not to.
- GKE is the right choice when you need Kubernetes features: StatefulSets, DaemonSets, CRDs, service meshes, or platform-level orchestration across many services.
- Compute Engine is the right choice when you need full VM control: custom OS, persistent local disk, legacy software that cannot be containerised, or network appliance workloads.
- All three connect through the same VPC. Using more than one is normal and expected in production.
- If you are unsure, start with Cloud Run. You can always move a workload to GKE or Compute Engine later.
Cloud Run until you can’t, GKE when you need Kubernetes, Compute Engine when you need a VM. Most teams should start and stay with Cloud Run for the majority of their services.
Simple explanation
Cloud Run is like ordering from a food delivery app. You pick what you want, someone else cooks it, delivers it, and cleans up. You never see the kitchen. You only pay for what you eat.
GKE is like running a commercial kitchen with a head chef (Kubernetes). You own the kitchen, set the menu, control every recipe and process. The head chef manages the cooks and keeps things running, but you still handle hiring, equipment, and the lease.
Compute Engine is like renting a raw commercial space and building a kitchen from scratch. You install the ovens, plumbing, and ventilation yourself. Total control, total responsibility.
Cloud Run runs containers without you managing servers. You give it a container image and Google handles scaling, load balancing, TLS, and the underlying infrastructure. When nobody is calling your service, Cloud Run shuts it down and you pay nothing. When traffic arrives, it starts instances automatically.
GKE (Google Kubernetes Engine) runs containers on a Kubernetes cluster. You get the full Kubernetes API, meaning you control how containers are scheduled, scaled, networked, and stored. Google manages the Kubernetes control plane. You manage the workloads and (in Standard mode) the node VMs.
Compute Engine gives you full virtual machines. You choose the OS, configure the disk, install whatever software you want, and manage the machine directly. There is no container requirement.
Key terms if you are new to this
- Stateless: The service does not store data locally between requests. Any instance can handle any request. Most APIs and web servers are stateless.
- Stateful: The service keeps data in local memory or disk that must persist between requests. Databases, caches, and message brokers are stateful.
- Cluster: A group of machines (nodes) managed together. In GKE, the cluster runs your Kubernetes workloads.
- Node: A single machine (VM) in a cluster. GKE nodes are Compute Engine VMs under the hood.
- Service mesh: A networking layer that controls how services communicate, handling mutual TLS, retries, and traffic routing. Only available natively in Kubernetes environments.
How to choose: decision framework
Work through these questions in order. Stop at the first “yes.”
- Do you need a full VM or OS-level control? Custom kernel, specific Linux distro, Windows Server, software that cannot run in a container, persistent local SSDs, or a network appliance? Choose Compute Engine.
- Do you need Kubernetes-specific features? StatefulSets with persistent volumes, DaemonSets, Custom Resource Definitions, Operators, a service mesh (Istio/Anthos Service Mesh), namespace-level RBAC, or Pod Disruption Budgets? Choose GKE.
- Is the workload stateless and driven by HTTP requests or events? REST APIs, GraphQL endpoints, webhook handlers, Pub/Sub consumers, or Cloud Scheduler jobs? Choose Cloud Run.
- Is the workload always-on, long-running, or heavily customised? A background worker that does not respond to HTTP, a self-managed database, or a highly tuned application server? Evaluate whether GKE (as a Deployment) or Compute Engine (as a persistent VM) fits better based on whether you need Kubernetes features or raw VM control.
- Are cost and minimal operations your top priorities? If the workload can be containerised and is not deeply stateful, Cloud Run almost always wins on both.
Most new projects should start with Cloud Run. You do not need to predict your final architecture on day one. All three services share the same VPC, so you can add GKE or Compute Engine later without rearchitecting what you already have.
At-a-glance comparison table
| Dimension | Cloud Run | GKE | Compute Engine |
|---|---|---|---|
| Best for | Stateless HTTP/event workloads | Multi-service platforms needing Kubernetes features | Full VM/OS control, legacy apps, non-container workloads |
| Deployment unit | Container image | Kubernetes manifest + container image | VM image or startup script |
| Operational overhead | Near zero | Medium to high (cluster upgrades, node management, RBAC) | High (OS patching, disk management, networking config) |
| Scaling model | Automatic, request-based | HPA + Cluster Autoscaler | Managed instance groups with autoscaling |
| Scale to zero | Yes | No (minimum node count or Autopilot pod minimum) | No |
| Stateful support | Limited (no persistent local storage) | Yes (StatefulSets, PersistentVolumeClaims) | Yes (full disk control) |
| GPU/accelerator support | Yes (NVIDIA GPUs in supported regions) | Yes (GPU node pools, TPU) | Yes (widest GPU/TPU selection) |
| Networking/VPC model | Direct VPC egress or Serverless VPC Access connector | Native VPC (VPC-native clusters) | Native VPC |
| Security/control level | Managed TLS, IAM-based access, sandboxed containers | Workload Identity, namespace RBAC, network policies | Full OS control, firewall rules, IAP, custom hardening |
| Cost pattern | Per request + CPU/memory time; $0 at idle | Per node VM time (Standard) or per pod resource (Autopilot) | Per second of VM time; always-on cost |
| Learning curve | Low | High (Kubernetes knowledge required) | Medium (Linux/Windows sysadmin skills) |
| Typical team fit | Small teams, startups, app developers | Platform teams, DevOps engineers, orgs on Kubernetes | Infra teams, sysadmins, VM-level control workloads |
When to use Cloud Run
Best-fit workloads
Cloud Run works best for stateless services that respond to HTTP requests or consume events. It handles scaling, TLS termination, load balancing, and deployment rollouts automatically.
Why it wins
- Zero infrastructure management. No servers, no clusters, no nodes.
- Scales to zero. You pay nothing when nobody is calling your service.
- Deploys in under a minute. One command to ship a new version.
- Built-in traffic splitting for canary and blue/green deployments.
- Connects to VPC resources through Direct VPC egress or Serverless VPC Access connectors.
When not to use it
- Deeply stateful workloads that need persistent local volumes.
- Workloads requiring Kubernetes-specific primitives (DaemonSets, CRDs, Operators).
- Workloads that need a service mesh for inter-service traffic management.
- Applications that require a custom OS, kernel, or non-container runtime.
Practical examples
- A REST API serving variable traffic from a mobile app.
- A webhook receiver that processes Pub/Sub messages and writes to Cloud SQL.
- A scheduled batch job that runs nightly via Cloud Scheduler and Cloud Run Jobs.
- A GPU-backed inference endpoint serving ML model predictions in a supported region.
When to use GKE
Best-fit workloads
GKE is the right choice when you need the Kubernetes API and the platform-level control it provides. This includes multi-service platforms, stateful container workloads, and organisations that have standardised on Kubernetes.
Where Cloud Run is a single app on your phone, GKE is the phone’s entire operating system. It manages how many apps (services) run at once, how they talk to each other, how they share resources, and what happens when one crashes. That power is valuable when you have many services to coordinate. For a single service, it is overkill.
Why it wins
- Full Kubernetes API: Deployments, StatefulSets, DaemonSets, CRDs, Operators.
- Fine-grained networking with network policies, service meshes, and VPC-native clustering.
- Persistent storage via PersistentVolumeClaims for stateful workloads.
- GPU node pools for ML training and inference at scale.
- Autopilot mode reduces node management overhead while keeping the full Kubernetes API.
When not to use it
- Simple stateless HTTP services. Cloud Run handles these with far less overhead.
- Teams without Kubernetes expertise and no plan to build it.
- Low-traffic workloads where the baseline cluster cost is disproportionate.
Practical examples
- A microservices platform with 20+ services, shared service mesh, and namespace-based team isolation.
- A Redis or Kafka deployment using StatefulSets with persistent volumes.
- A GPU-backed ML training pipeline using node pools with NVIDIA GPUs or TPUs.
- An enterprise platform team providing a self-service container platform to application teams.
When to use Compute Engine
Best-fit workloads
Compute Engine is the right choice when you need direct control over the operating system, disk, networking, or hardware. It also serves as the foundation for lift-and-shift migrations where refactoring into containers is impractical.
Why it wins
- Full OS control. Choose any Linux distribution, Windows Server, or custom image.
- Direct access to local SSDs, persistent disks, and custom disk configurations.
- Widest selection of GPU and TPU accelerator types.
- SSH access for troubleshooting, profiling, and direct management.
- Lowest per-unit cost at sustained high scale with committed use discounts and Spot VMs.
When not to use it
- Stateless HTTP services. Cloud Run is simpler, cheaper at variable traffic, and requires no OS patching.
- Container-based platforms that need orchestration. GKE handles scheduling, scaling, and service discovery natively.
- Workloads where scaling speed matters. VM boot times are minutes, not seconds.
Practical examples
- A self-managed PostgreSQL or MySQL database on a high-memory VM with local SSDs.
- A legacy .NET Framework application that cannot be containerised.
- CI/CD build agents that need full OS access and high disk throughput.
- A network appliance (firewall, VPN gateway) that requires custom kernel modules.
Common real-world scenarios
| Scenario | Recommended | Why |
|---|---|---|
| Small REST API with bursty traffic | Cloud Run | Scales to zero between bursts. No idle cost. Deploys in seconds. |
| Internal microservice platform (10+ services) | GKE | Namespace isolation, service mesh, shared ingress, unified RBAC across services. |
| Stateful worker or message broker | GKE (StatefulSet) or Compute Engine | Needs persistent local storage. GKE if already running a cluster; Compute Engine if standalone. |
| Legacy app migration (lift-and-shift) | Compute Engine | Runs on a VM without refactoring. Same OS, same configuration, new location. |
| GPU-backed ML inference (HTTP) | Cloud Run (if supported region) or GKE | Cloud Run supports NVIDIA GPUs for inference endpoints. GKE for more GPU types or heavier training. |
| Batch/scheduled processing | Cloud Run Jobs | Runs on a schedule via Cloud Scheduler. No always-on infrastructure. |
| High-throughput always-on platform | GKE or Compute Engine | GKE if container-based. Compute Engine if VM-based. Both benefit from committed use discounts. |
| Enterprise team standardising on Kubernetes | GKE Autopilot | Full Kubernetes API with reduced node management. Platform team provides the cluster; app teams deploy. |
Cloud Run vs GKE
This is the most common comparison because both run containers. The core trade-off is control versus simplicity.
Choose Cloud Run when the workload is stateless, responds to HTTP or events, and does not need Kubernetes primitives. Cloud Run eliminates cluster management, node upgrades, and manifest maintenance entirely. For a deeper comparison, see GKE vs Cloud Run.
Choose GKE when you need StatefulSets, DaemonSets, CRDs, a service mesh, namespace-level isolation, or when your team has already invested in Kubernetes tooling. GKE gives you control Cloud Run does not expose, but that control adds operational cost.
GKE Autopilot narrows the gap by removing node management, but you still maintain Kubernetes manifests, configure RBAC, and manage upgrades. Cloud Run removes all of that. See Kubernetes vs Serverless for the broader trade-off.
Cloud Run vs Compute Engine
These two sit at opposite ends of the abstraction spectrum.
Choose Cloud Run when you can package the workload as a container and it does not need persistent local storage, a custom OS, or always-on VM access. Cloud Run is cheaper at variable traffic, deploys faster, and requires no patching. For detailed cost modelling, see Cloud Run vs Compute Engine.
Choose Compute Engine when the workload needs a full VM: custom kernel, Windows Server, software that expects a traditional OS environment, or direct hardware access. Compute Engine also wins on per-unit cost at sustained high scale with committed use discounts.
If your workload can fit in a Docker container and does not need persistent local disk, start with Cloud Run. You can always move to a VM later. Moving from a VM to Cloud Run is harder because it requires containerising the app first.
GKE vs Compute Engine
Both require you to manage infrastructure, but at different levels.
Choose GKE when the workloads are containerised and you need orchestration: scheduling, scaling, service discovery, and rolling updates across multiple services. GKE handles these natively through the Kubernetes API. See Compute Engine vs GKE for a detailed comparison.
Choose Compute Engine when the workloads are not containerised, need a specific OS, or when adding a Kubernetes cluster would be overkill for a small number of VMs. Managed instance groups with autoscaling give you scaling without Kubernetes.
Cost and operational trade-offs
Cost depends on traffic pattern, instance shape, memory, region, egress, concurrency settings, and discount commitments. There is no single cheapest option. The right answer depends on your workload profile.
Cloud Run is like pay-as-you-go electricity. You only pay when the lights are on. Great if you use power in short bursts with gaps in between.
GKE and Compute Engine are like a fixed-rate energy contract. You pay a steady monthly amount regardless of how much you actually use. If your usage is constant and high, the fixed rate is cheaper per unit. If usage is variable, you end up paying for capacity you are not using.
At idle or low traffic
Cloud Run wins. It scales to zero and costs nothing when idle. GKE Standard clusters have a baseline control plane and node cost even with no traffic. Compute Engine VMs bill per second regardless of utilisation. For cost strategies at low traffic, see Cloud Run Cost Optimisation.
At bursty or variable traffic
Cloud Run wins again. Per-request billing means you pay proportionally to actual traffic. GKE and Compute Engine autoscaling helps, but both have lag and minimum resource floors. Cloud Run scales in seconds.
At steady, moderate traffic
The gap narrows. A well-sized GKE Autopilot cluster or Compute Engine VM approaches Cloud Run’s effective cost. The operational cost of managing that infrastructure is the real differentiator at this tier.
At sustained high traffic
Compute Engine and GKE Standard with committed use discounts (1-year saves up to 37%, 3-year up to 55%) produce the lowest per-unit compute cost. Cloud Run per-request billing becomes more expensive relative to reserved capacity at this scale. See Compute Engine Cost Optimisation for discount strategies.
Operational cost is real cost
Cloud Run requires near-zero operational effort. GKE requires Kubernetes expertise, cluster upgrades, node pool management, and manifest maintenance. Compute Engine requires OS patching, disk management, and custom monitoring. Engineer time spent on infrastructure is a cost that does not appear on your GCP bill, but it affects your total spend.
Common mistakes
- Choosing GKE for prestige instead of requirement.
GKE is not automatically better because it is more complex. If your workloads are stateless HTTP services, Cloud Run serves them with less cost and less operational risk. Only add GKE when you need a specific Kubernetes feature.
- Forcing stateful workloads into Cloud Run.
Cloud Run containers are ephemeral. If your service needs persistent local disk, long-lived connections, or in-memory state across requests, it belongs on GKE (StatefulSets) or Compute Engine. Use external state stores like Cloud SQL or Firestore to keep services stateless where possible.
- Choosing Compute Engine for simple stateless services.
Running a REST API on a manually managed VM means you own OS patching, TLS configuration, load balancing, scaling, and deployment tooling. Cloud Run handles all of this automatically.
- Ignoring your team’s operating capacity.
A three-person team running a complex GKE cluster will spend more time on infrastructure than on the product. Match the platform to your team’s size and skill set, not to a theoretical ideal.
- Using one platform for everything by default.
Different workloads have different requirements. A healthy architecture uses the right compute service for each layer. Standardising on one option to reduce cognitive load often increases cost and complexity instead.
Recommended starting path
If you are building a new project and are not sure where to start:
- Deploy all HTTP services to Cloud Run. Zero operational overhead. Deploys in under a minute. Costs nothing at idle.
- Use managed data services. Cloud SQL for relational data. Firestore for document data. Neither requires a GKE cluster or a self-managed VM.
- Use Pub/Sub or Cloud Tasks for async work. Cloud Run handles both via push subscriptions and task handler endpoints. See Event-Driven Systems in GCP for patterns.
- Add GKE when you hit a concrete Kubernetes requirement. StatefulSets, DaemonSets, CRDs, or a service mesh. Start with GKE Autopilot to avoid node management.
- Add Compute Engine when you hit a concrete VM requirement. Legacy software, custom OS, specific hardware, or a self-managed database with local SSDs.
This progression keeps operational complexity minimal in the early stages while keeping all options open. Cloud Run, GKE, and Compute Engine all connect through the same VPC, so adding a new compute layer to an existing architecture does not require rearchitecting what you have already built.
Frequently asked questions
What is the default choice for a new API in Google Cloud?
Cloud Run. It handles stateless HTTP traffic with zero infrastructure management, scales to zero when idle, and deploys in under a minute. Unless you need StatefulSets, a service mesh, or full VM-level OS control, start with Cloud Run and move workloads to GKE or Compute Engine only when you hit a concrete limit.
Can I use Cloud Run, GKE, and Compute Engine together?
Yes, and most mature production environments do. A typical setup might use Cloud Run for the API layer, GKE for stateful background workers and platform services, and Compute Engine for a self-managed database or legacy application. All three connect through the same VPC network. Using the right tool for each workload layer is good engineering, not fragmentation.
Is GKE always better for production workloads?
No. GKE adds significant operational complexity: cluster upgrades, node pool management, RBAC, resource tuning, and Kubernetes manifest maintenance. For stateless HTTP services, Cloud Run provides the same reliability with far less operational overhead. GKE is the right production choice only when you need Kubernetes-specific features like StatefulSets, DaemonSets, CRDs, or service meshes.
When is Compute Engine still the right answer?
Compute Engine is the right choice when you need full OS-level control: custom kernels, specific Linux distributions, Windows Server workloads, software that cannot be containerised, persistent local SSDs for database engines, or network appliances. It is also the right choice for lift-and-shift migrations where refactoring into containers is not practical.
How should I think about cost before choosing?
At low or variable traffic, Cloud Run is almost always cheapest because it scales to zero and bills per request. At sustained high traffic, Compute Engine or GKE with committed use discounts can be significantly cheaper per unit of compute. The key variables are traffic pattern (bursty vs steady), idle time, memory and CPU requirements, egress volume, and whether you can commit to 1-year or 3-year reservations.