Choosing between Cloud Run and GKE

Vinay Damle
Google Cloud - Community
3 min readJan 3, 2024

Choosing between Cloud Run and GKE

In this article we will discuss some aspects/factors which need to be considered while making a choice between GCP’s 2 powerful services. I would like to emphasise that the choice may depends on various other (minor) factors however here we would be discussing some major factors

Following will be discussed

  • What is Cloud Run?
  • What is GKE?
  • Factors to consider Cloud Run and GKE

What is Cloud Run?

Cloud Run is a managed compute platform that lets you run containers directly on top of Google’s scalable infrastructure.

You can deploy code written in any programming language on Cloud Run if you can build a container image from it. In fact, building container images is optional. If you’re using Go, Node.js, Python, Java, .NET Core, or Ruby, you can use the source-based deployment option that builds the container for you, using the best practices for the language you’re using.

Services and jobs: two ways to run your code

On Cloud Run, your code can either run continuously as a service or as a job. Both services and jobs run in the same environment and can use the same integrations with other services on Google Cloud.

  • Cloud Run services. Used to run code that responds to web requests, or events.
  • Cloud Run jobs. Used to run code that performs work (a job) and quits when the work is done.

What is GKE (Google Kubernetes Engine)?

GKE is a Google-managed implementation of the Kubernetes open source container orchestration platform. Kubernetes was developed by Google, drawing on years of experience operating production workloads at scale.

GKE is ideal if you need a platform that lets you configure the infrastructure that runs your containerised apps, such as networking, scaling, hardware, and security. GKE provides the operational power of Kubernetes while managing many of the underlying components, such as the control plane and nodes.

GKE offers the following modes of operation for clusters:

  • Autopilot mode (recommended): GKE manages the underlying infrastructure such as node configuration, autoscaling, auto-upgrades, baseline security configurations, and baseline networking configuration.
  • Standard mode: You manage the underlying infrastructure, including configuring the individual nodes.

Factors to consider Cloud Run and GKE

Some additional factors to consider:

  • Team expertise: If your team is not familiar with Kubernetes, Cloud Run’s managed approach may be easier to adopt.
  • Monitoring and logging: Both Cloud Run and GKE offer monitoring and logging capabilities, but GKE may require more setup for custom needs.
  • Portability: Both Cloud Run and GKE are based on open standards, so your applications can be ported to other platforms if needed.

Finally, the choice for you depends on your specific needs and priorities

  • Simple serverless platform is Cloud Run; recommended for stateless applications
  • For complex deployments with more control or stateful applications; GKE could be a better option

References

Author

Vinay Damle

Aritra Banerjee

--

--