Instructions et exigences de configuration de l'atelier
Protégez votre compte et votre progression. Utilisez toujours une fenêtre de navigation privée et les identifiants de l'atelier pour exécuter cet atelier.
AHYBRID-132: Receive Pub/Sub events with Eventarc and Cloud Run
Ce contenu n'est pas encore optimisé pour les appareils mobiles.
Pour une expérience optimale, veuillez accéder à notre site sur un ordinateur de bureau en utilisant un lien envoyé par e-mail.
Overview
In this exercise, you deploy a Cloud Run service and use Eventarc to receive
events from Pub/Sub. In the second part of the lab, you do the same on an
Anthos GKE cluster with the Cloud Run for Anthos offering.
Objectives
In this lab, you learn how to:
Deploy an event receiver service to Cloud Run and Cloud Run for Anthos.
Create an event trigger with Eventarc.
Publish a message to a Pub/Sub topic to generate an event, and view it in the
Cloud Run and Cloud Run for Anthos logs.
Setup and requirements
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Sign in to Google Skills using an incognito window.
Note the lab's access time (for example, 1:15:00), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
Task 1. Review your Anthos GKE cluster and install Cloud Run for Anthos
In this task, you review and prepare the already created Anthos GKE cluster to
execute Cloud Run for Anthos. First, you verify that the GKE cluster has been
registered in an Anthos Fleet. Second, you confirm that Anthos Service Mesh has
been installed in the cluster as a prerequisite to installing Cloud Run for
Anthos. Third, you enable and install Cloud Run for Anthos in the cluster.
In the Google Cloud Console, on the Navigation menu
(), click Kubernetes Engine > Clusters.
Notice that a new GKE cluster has been created.
Click Workloads, and verify that the cluster is running the Anthos
Service Mesh components istio-ingressgateway and istiod-asm.
On the Navigation menu, click Anthos > Clusters, and then verify that the
cluster has been registered and appears in the list of Anthos managed clusters.
Click Activate Cloud Shell (). If
prompted click Continue.
In Cloud Shell, set the Zone environment variable:
C1_ZONE={{{ project_0.default_zone| "Zone added at lab start" }}}
In Cloud Shell, initialize the environment variables:
export PROJECT_ID=$(gcloud config get-value project)
export C1_NAME="gke"
gcloud config set run/region us-central1
gcloud config set run/platform managed
gcloud config set eventarc/location us-central1
If this step fails, wait 30 seconds and try again.
Note: Enabling Cloud Run for Anthos takes several
minutes; continue with the next task. Later, you review whether the
installation has been successful.
Task 2. Deploy a Cloud Run application
In Cloud Shell, clone the repository:
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
cd nodejs-docs-samples/eventarc/pubsub/
This creates a new Pub/Sub topic and a trigger for it called
events-pubsub-trigger. The Pub/Sub subscription persists regardless of
activity and does not expire.
Confirm that the trigger was successfully created:
gcloud eventarc triggers list --location=us-central1
Find and set the Pub/Sub topic as an environment variable:
This creates a new Pub/Sub topic and a trigger for it called
pubsub-trigger. The Pub/Sub subscription persists regardless of
activity and does not expire.
Confirm that the trigger was successfully created:
gcloud eventarc triggers list --location=us-central1
Find and set the Pub/Sub topic as an environment variable:
Send a message to the Pub/Sub topic to generate an event:
gcloud pubsub topics publish $RUN_TOPIC --message "Cloud Run on Anthos"
The event is sent to the Cloud Run for Anthos service, which logs the event
message.
To view the event message in the service logs, on the
Navigation menu, click Kubernetes Engine > Applications.
Click on Go to List of Services.
Click on the subscriber-service.
On the Logs tab, look for the "Hello, Cloud Run on Anthos!" message.
Congratulations! You deployed a Cloud Run for Anthos
application and used Eventarct to trigger events from Pub/Sub.
End your lab
When you have completed your lab, click End Lab. Google Skills removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
1 star = Very dissatisfied
2 stars = Dissatisfied
3 stars = Neutral
4 stars = Satisfied
5 stars = Very satisfied
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2026 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
Les ateliers créent un projet Google Cloud et des ressources pour une durée déterminée.
Les ateliers doivent être effectués dans le délai imparti et ne peuvent pas être mis en pause. Si vous quittez l'atelier, vous devrez le recommencer depuis le début.
En haut à gauche de l'écran, cliquez sur Démarrer l'atelier pour commencer.
Utilisez la navigation privée
Copiez le nom d'utilisateur et le mot de passe fournis pour l'atelier
Cliquez sur Ouvrir la console en navigation privée
Connectez-vous à la console
Connectez-vous à l'aide des identifiants qui vous ont été attribués pour l'atelier. L'utilisation d'autres identifiants peut entraîner des erreurs ou des frais.
Acceptez les conditions d'utilisation et ignorez la page concernant les ressources de récupération des données.
Ne cliquez pas sur Terminer l'atelier, à moins que vous n'ayez terminé l'atelier ou que vous ne vouliez le recommencer, car cela effacera votre travail et supprimera le projet.
Ce contenu n'est pas disponible pour le moment
Nous vous préviendrons par e-mail lorsqu'il sera disponible
Parfait !
Nous vous contacterons par e-mail s'il devient disponible
Un atelier à la fois
Confirmez pour mettre fin à tous les ateliers existants et démarrer celui-ci
Utilisez la navigation privée pour effectuer l'atelier
Le meilleur moyen d'exécuter cet atelier consiste à utiliser une fenêtre de navigation privée. Vous éviterez ainsi les conflits entre votre compte personnel et le compte temporaire de participant, qui pourraient entraîner des frais supplémentaires facturés sur votre compte personnel.
Build, deploy, and execute a containerized application in Google Cloud Run and Cloud Run for Anthos and leverage Eventarc to receive Pubsub messages.
Durée :
49 min de configuration
·
Accessible pendant 90 min
·
Terminé après 90 min