Google Cloud Run service url (discovery)

Viewed 2686

I am running several gcloud services which have assigned urls automatically in following format:

https://SERVICE_NAME-XXXXXXX-ew.a.run.app/

This is not particularly easy to work with and to pass these URLs to clients. Alternative is to use the custom domain, but this needs hardcoding subdomains within DNS records (as far as I understand) and I would like to avoid that and use the default URLs.

What is the best practice to work with these URLs? I can imagine keeping some mapping of service->URL and passing it to clients, but I would like to avoid reinventing the wheels.

2 Answers

Edit: I've released an external tool called runsd that lets you do this. Check it out: https://github.com/ahmetb/runsd


Thanks for this question! The "Service discovery by name" for Cloud Run is very much an active area of work. Though, there are no active timelines we can share yet.

You can see a prototype of me running this on Cloud Run here: https://twitter.com/ahmetb/status/1233147619834118144

APIs like Google Cloud Service Directory linked are geared more towards custom/DIY service discovery you might want to build to your RPC stack such as gRPC. It's more of a managed domain name directory, that you can integrate with your RPC.

If you are interested in participating an alpha for this feature in the future, drop me an email at ahmetb at google.

You can use a beta service Service Directory.

At service deployment

  • Create your service with a name and the URL as metadata

In your code

  • Request the service metadata with its name, and get the URL
  • Use the url

You can't use the endpoint feature of the service because your don't have IP/Port.

However, for now, there is client library and you have to use API directly.

Related