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

2 Answers

Kolban On

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:

John Hanley On

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.