Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the value proposition of running Cloud Run versus a normal service in GKE?

Is there any advantage if I use Cloud Run instead of deploying a normal service/container in GKE?

like image 567
chriz Avatar asked Apr 21 '19 21:04

chriz


People also ask

What is the difference between GKE and cloud run?

There are many distinctions in using Cloud Run to expose a service as compared to running it natively in GKE. The primary of these is that Cloud Run provides more of a serverless infrastructure. Basically you declare that you want to expose a service and then let GCP do the rest.

What is Google Cloud Run and how does it work?

Google services like Cloud Functions can be used to split a container’s functions into their own services (FaaS). With Cloud Run, you only pay for what you use. Billed time is broken down to the nearest 0.1 of a second.

What is the difference between Cloud Run and Kubernetes?

The primary of these is that Cloud Run provides more of a serverless infrastructure. Basically you declare that you want to expose a service and then let GCP do the rest. Contrast this with creating a Kubernetes cluster and then defining your service in pods.

What is the difference between Cloud Run and cloud function?

Cloud Function Cloud Functions are serverless, single purpose and event driven solution. Cloud Run is build on top of Knative, that allows to serve stateless containers in a serverless way and it’s natively portable. When you develop for Cloud Run, you have to build a container.


2 Answers

I will try to add my perspective.

This answer does not cover running containers in Google Cloud Run Kubernetes. The reason is that we wanted an almost zero cost solution for a legacy PHP website. Cloud Run fit perfectly and we had an easy time both porting the code and learning Cloud Run.

We needed to do something with a legacy PHP website. This website was running on Windows Server 2012, IIS and PHP 7.0x. The cost was over $100.00 per month - mostly for Windows licensing fees for a VM in the cloud. The site was not accessed very much but was needed for various business reasons.

A decision was made Thursday (4/18/2019) was that we needed to learn Google Cloud Run, so we decided to port this site to a container and try to run the container in Google Cloud. Nothing like a real world example to learn the details.

Friday, we ported the PHP code to Apache. Very easy process. We did not worry about SSL as we intend to use Cloud Run SSL.

Saturday we started to learn Cloud Run. Within an hour we had the Hello World PHP example running. Link.

Within two hours we had the containerized website running in Cloud Run. Again, very simple.

Then we learned how to configure Cloud Run SSL with our DNS server.

End result:

  1. Almost zero cost for a PHP website running in Cloud Run.
  2. Approximately 1.5 days of effort to port the legacy code and learn Cloud Run.
  3. Savings of about $100.00 per month (no Windows IIS server).
  4. We do not have to worry about SSL certificates from now on for this site.

For small websites that are static, Cloud Run is a killer product. The learning curve is very small even if you do not know Google Cloud. You just need to configure gcloud for container builds and deployment. This means developers can be independant of needing to master GCP.

like image 143
John Hanley Avatar answered Sep 22 '22 07:09

John Hanley


There are many distinctions in using Cloud Run to expose a service as compared to running it natively in GKE. The primary of these is that Cloud Run provides more of a serverless infrastructure. Basically you declare that you want to expose a service and then let GCP do the rest. Contrast this with creating a Kubernetes cluster and then defining your service in pods. With a manually created GKE cluster, the nodes and environment are always on which means that you are billed for them regardless of utilization. With Cloud Run, your service is merely available and you are only billed for actual consumption. If your service not being called, your costs are zero. Another advantage is that you don't have to predict your utilization needs and allocate sufficient nodes. Scaling happens automatically for you.

See also these presentations from Google Next 19:

  • Migrating from a Monolith to Microservices (Cloud Next '19)
  • What's New in Serverless Compute? (Cloud Next '19)
  • Run Containers on GCP's Serverless Infrastructure (Cloud Next '19)
  • Run Cloud Functions Everywhere (Cloud Next '19)
  • Container Once, Serverless Anywhere (Cloud Next '19)
like image 45
Kolban Avatar answered Sep 22 '22 07:09

Kolban