At the last Google Next, Google announced a new serverless compute offering: Cloud Run. The service is currently beta and as stated in the product page:
Run stateless HTTP containers on a fully managed environment or in your own GKE cluster.
A very intriguing feature of Cloud Run is that you can run it on your Kubernetes cluster in GKE. This is possible because the technology used for Cloud Run is Knative, the same technology used for TriggerMesh cloud. Whether Knative internals are used in Cloud Run or only its API, can almost be seen as an implementation detail. The interesting part is that Knative is the common link between the two.
In this post, we will show you how you can deploy a service in Cloud Run and deploy the exact same service using the same API manifest to the TriggerMesh Cloud.
Take away: Knative gives you multicloud capability for your serverless workload.
First, let’s deploy the basic Hello World example of Cloud Run. You can do it through the Google console or through the gcloud CLI as shown below:
The pre-built container gets deployed, will scale to zero if the application is not used and you will only be charged per function calls.
You can access the application with your browser:
With your sample Hello application running, you can now describe the API objects that corresponds to it. Again using the CLI, you can get the JSON manifest, massage it a bit with jq and get back the container image being used:
To save the full manifest, simply redirect it to a file hello.yaml like so:
If you peek into the file you will see that it is a Knative Service object:
If you register to TriggerMesh and download your configuration file you will be able to create Knative objects with the tm CLI and even with the Kubernetes CLI kubectl. Let’s try it with kubectl as shown below and our Cloud Run manifest obtained in the prior section:
We can now describe our TriggerMesh service and get the URL of our new application:
Take your browser and open the equivalent of https://hello-sebgoa.k.triggermesh.io/ and you will enjoy the Cloud Run hello application on a different cloud!
Note that using the TriggerMesh client `tm` you could also deploy the same container as in Cloud Run with a similar CLI syntax:
Subscribe to TriggerMesh newsletter. You'll get only the most important news about TriggerMesh