Reputation: 3113
When registering a service in Consul I need to pass Address
. But to do so I need to know this address in the first place. This is not always a trivial task if you have multiple network interfaces.
Is there a way to use the source address from the request itself? Wherever it came from just take the source address and use it
Upvotes: 0
Views: 348
Reputation: 17803
The service catalog is a... catalog, the address that services are registered should be accessible by whoever queries the catalog.
I don't believe there's an automatic solution for this, but you can:
register the service multiple times with different tags for the different network interfaces, query the relevant tag.
register the service multiple times with different service names for the different network interfaces. e.g. (myservice-lan1, myservice-lan2). query the relevant service name.
run multiple consul clusters, set with different datacenters and use each subnet as a different datacenter.
Upvotes: 1