Search code examples
google-cloud-platformgoogle-cloud-pubsubgoogle-cloud-rungoogle-cloud-scheduler

Using Pub/Sub on a public Cloud Run service


According to the "Authenticating service-to-service" documentation for Cloud Run, to use Pub/Sub and Cloud Scheduler on a service, unauthenticated access must be disabled because they rely on HTTP calls because of the zero scaling capability of Cloud Run services.

My services allow internal and Load Balancer traffic and must be publicly available for frontend clients, but they also must be able to communicate with each other privately with Pub/Sub.

Is there a way to achieve this? It feels unnatural to create a separate private service just for using Pub/Sub.


Solution

  • It's a missing piece. You can't plug in your VPC PubSub push subscription and Cloud Scheduler (but also Cloud Task, Cloud Build, Workflows,...). I asked Google Cloud few months ago, and it should be fixed by a new network features, soon. At least in 2021!

    So, in your case, if your Cloud Run service is accessible from the public internet through a Load Balancer, you can use this public endpoint to call the path that you want on your service and thus perform the process.

    If your Cloud Run in only accessible from ingress=internal, you can't for now.