GoogleCloudPlatform / click-to-deploy

Source for Google Click to Deploy solutions listed on Google Cloud Marketplace.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect consul application with microservice in google cloud run

lacerdanycolas opened this issue · comments

Category:

Kubernetes apps

Type:

  • Bug
  • Feature Request
  • [ X ] Process

I implemented the consul application available in the google marketplace, and created a microservice with gcloud run that should register in consul. However, the microservice does not recognize the name of the consul service on the network. I have already connected to a shared VPC so that both can see each other, but it presents the error below.

Caused by: java.net.UnknownHostException: consul: Name or service not known.

And my deployment code is as follows

gcloud run deploy bpms-gateway --image $CONTAINER_REGISTRY/$GCP_PROJECT_ID/$IMAGE_REPOSITORY/bpms-gateway:0.0.2 --platform managed --region $RUN_REGION --port 8080 --vpc-connector=vcp-p2f-connector --update-env-vars SPRING_CLOUD_CONSUL_HOST=consul --allow-unauthenticated

And a tried:

  1. Replicate exactly what I did in my local environment (using docker-compose) by creating an environment variable SPRING_CLOUD_CONSUL_HOST passing the name of the service to it;

  2. Pass in the variable the value consul-shared-consul-server (Consul HTTP API) but not solved;

Image with info from components application
consulapplicationclick

Any ideias to solve this? Thanks.