Implicit connection across datacenters

Hello,

We are evaluating Consul for our use and have been looking through some of the documentation. I see several examples of setting up Federation via the Service Mesh, but all of the cross-dc examples use the explicit mention of a datacenter. e.g. https://www.consul.io/docs/connect/connect-internals, https://learn.hashicorp.com/consul/developer-mesh/connect-gateways and https://www.consul.io/docs/agent/config-entries/service-resolver.

Based upon these examples, is there any implicit discovery of services across datacenters - or, more broadly, the ability to add new datacenters solely via configuration of gateways and/or servers? We are trying to keep client configuration to a minimum and to be able to expand/contract the mesh with a minimum of manual configuration.

I think this is a good demonstration of adding a datacenter and it’s services:

Thanks for that video, it was definitely informative.

Unfortunately, it doesn’t seem to cover the case I was discussing. The connect-service-upstream still specifies port and datacenter information. The video also didn’t include a connection from one proxied service to another across the WAN (it used the terminating gateway instead). The hope I had was that Consul could register a service endpoint, or endpoints, along with port and datacenter information, and that usage would be transparent to any clients inside the mesh. Since all of that information is available during lookup, it seems redundant to have to specify it again elsewhere.

I’m very early in my investigation, however, so I will continue to learn more about this. Definitely correct me if I’m wrong in my assumptions here, I absolutely could be missing something key. Regardless, I do appreciate that information - it does help to understand (and see) some of the migration in action.

Hi @cjratt,

Consul service-resolvers provide the ability to redirect traffic destined to a service within a given data center to instances of the same or different service in a remote data center.

Here’s an example of creating a virtual service which redirects to a service in a secondary DC.

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

You can also define failover policies which will redirect traffic to a list of remote DCs if there are no available instances in the source DC.

Kind           = "service-resolver"
Name           = "web"
ConnectTimeout = "15s"
Failover = {
  "*" = {
    Datacenters = ["dc3", "dc4"]
  }
}

Today you must explicitly configure applications to talk to the local proxy port. We are looking at adding transparent proxy support in the next release or two of Consul. I recommend keeping an eye on this GitHub issue for updates this feature request https://github.com/hashicorp/consul-k8s/issues/23.

I hope this is helpful. Let me know if I can provide any additional info.