Question regarding Consul WAN and Transparent Proxy

I have a two DCs with few services running in each DC on independent nodes. This is a VM based setup.

I have enabled transparent proxy on both the DCs. I am able to get things working with service1.virtual.consul being able to direct the traffic to correct “service1” within DC.

Now, I want to connect two DCs using WAN federation. I have done that but I am unable to find any relevant documentation that could guide as to how does it work along with transparent proxy.

My questions are

  1. Is transparent proxy supported across DCs? As in, can service 1 of DC1 be accessed as service1.virtual.consul from a service in DC2?
  2. If two DCs have a service registered by same name, when service.virtual.consul is hit, which service will be picked out of DC1 or DC2?
1 Like

Hi @yogesh.badke,

Welcome to HashiCorp Forums!

You cannot use transparent proxy to communicate between services across WAN Federated DCs. You will have to set the upstream explicitly in the sidecar definition of the downstream service.

You can read about these in the below links.

Ref:

I could get it working by connecting two DCs and then in each DC adding service resolvers for all services present in another DC like the following

Kind = "service-resolver"
Name = "service2"
Redirect {
  Service    = "service2"
  Datacenter = "dc2"
}

Is the practice correct or is it more of a hack?

Yes, this is a valid option.