-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Description:
Currently, when multiple Nomad jobs with the same service name are registered across different nodes in a Consul cluster, a DNS query for that service returns all registered records even of they are configured with unique sub domains(as node id via Nomad). This behavior enables DNS-based load balancing but does not provide the ability to target node-specific services.
I propose adding a feature that allows:
Toggling DNS-based load balancing on or off – so that users can choose between returning all instances of a service along with load balancing (default) or returning node specific service address as DNS response.
Returning node-specific DNS results – so that a query can optionally return only the records corresponding to the node making the request, or according to a configurable policy (e.g., based on node metadata, locality, or other criteria).
Use Case:
- Locality/Node specific Nomad Jobs may need to perform node-local queries for services to reduce cross-node latency(for geo spacial workloads) , for HA systems that is constrained by locality(such as Session persistence ) or for debugging.
- Certain workloads may require deterministic resolution instead of round-robin style load balancing.
Suggested Implementation Ideas:
- Introduce a service-level or query-level flag to enable/disable DNS load balancing.
- Optionally allow filtering based on node attributes, e.g., local-node=true, so DNS queries only return services registered on the local node.
Benefits:
- Better control over service discovery behavior for constrained environments.
- Reduced latency and improved locality-aware DNS resolution.
- Enables deterministic service routing for workloads requiring strict node affinity.