1
votes

I'm doing some test using Cloud Run in a local environment. Source code is here.

It is a really simple demo app made of 2 services that I execute on different port using gcloud cli:

hello-world
gcloud alpha code dev --builder=gcr.io/buildpacks/builder:v1 --local-port=8080
hello-world-2
gcloud alpha code dev --builder=gcr.io/buildpacks/builder:v1 --local-port=8081

I need to do an HTTP call from hello-world to hello-world-2. What is the best way to do this?

1
Did you try to perform a call on localhost:8081 from hello-world service?guillaume blaquiere
Yes... It is what is done but it doesn't work because localhost resolve on itself.lorenzomar

1 Answers

1
votes

The gcloud CLI creates your builds as a service in your local Kubernetes cluster, when you execute the gcloud alpha code dev command. All services there is created in that way in a Kubernetes cluster will be exposed with a internal DNS name you can use from other services. So from your hello-world service can you communicate with the hello-world-2 service on the URL: http://hello-world-2:8080

enter image description here