Multiracial • DEI Advocate • Traveler • Serverless Buff • Kubernetes Lover • Python Dev • Gopher • App Modernization Specialist at Google Cloud

Serverlesss Eventing: Intro To Eventing At Google

by | Dec 31, 2020 | Google Cloud, On Serverless, Serverless Eventing | 0 comments

Knative Eventing is being integrated into Google Cloud!

Yes, you read that correctly. After a year and a half of a managed Knative Serving in the form of Cloud Run and Cloud Run for Anthos, Google Cloud is now integrating Knative Eventing into our serverless offerings with two new features. Let’s explore them, shall we?!

EventArc for Fully Managed Cloud Run

For those of you familiar with our fully managed serverless offering called Cloud Run, you will be happy to know that we introduced Eventarc. This is currently in a "Preview" status but it is available for all to use today. It allows you to receive events from 60+ Google Cloud Sources via Cloud Audit Logs. Do you need more? Well you can customize further by using Google PubSub as your Eventing Bus.

eventarc sample 1
One awesome feature is that you can utilize the 
GUI to configure events as seen here.

No more walls of YAML to connect these events. Go ahead and try it out yourself. You can do it in your cloud account, using one of our GitHub demos, our using our CodeLab.

Events for Cloud Run for Anthos

Now what if you have a Kubernetes cluster hosted on GKE? Well some good news for you. We now have Events for Cloud Run for Anthos. You get the same benefits as you do with Eventarc but on your GKE cluster. There are a lot of reasons why people don’t want to go fully managed. Sometimes the environment is too opinionated and therefore limiting. Sometimes you want to expand and extend your experience by using an open source platform. There is no right or wrong answer here. The nice thing is that regardless of your reason, you have an option to use managed Knative Eventing on GKE.

events-gke-trigger
Just like before, you can utilize the GUI to 
configure events as seen here.

No more walls of YAML to connect these events. Go ahead and try it out yourself. You can do it in your cloud account Quick caveat, you need to enable eventing in your cluster in order to use this feature. We explain here under Initializing Events of Cloud Run for Anthos.

A quick way to set this up is to run the following:

gcloud beta events init --platform gke

Then when prompted, select your GKE cluster. You will also want to answer Y to all the prompts to create and bid the proper service accounts. n nTo verify that this is working, simply run this line:

kubectl get pods -n cloud-run-events
kubectl get pods -n knative-eventing

After you do this, you will need to create an event broker.nnFirst, create an events namespace (make sure you have authenticated to your cluster):nnbashnkubectl create namespace eventsnnnThen initialize it with the default secret:nbashngcloud beta events namespaces init events u002du002dcopy-default-secret u002du002dplatform gkennnAnd finally, create the event broker:nbashngcloud beta events brokers create default u002du002dnamespace events u002du002dplatform gkennnYou can check your work by running this command:nbashnkubectl get brokers -n eventsnnnYou can also use this GitHub demo using BigQuery. If you don’t want to use your our project, you can use CodeLabs.n

Two Choices For You

Both options are great ways to implement serverless eventing into your applications. Both leverage the CloudEvents specification and both seamlessly integrate with Google Cloud services.

The ultimate benefit, of course, is that it simplifies the process of binding your services to events with simple event triggers. To learn more, I recommend reviewing this video from Google Cloud Next 2020

%d bloggers like this: