Search code examples
consul

Every request in being resolved to port 80 in Consul


I am very new to consul and have registered a service with consul with following configuration. {"service": {"name": "wrapper", "tags": ["consul-wrapper"], "port":8000,"address":"127.0.0.1",}} I have also set up dnsmasq so that dns queries get resolved by consul server running on 127.0.0.1:8600

Now whenever I try to access my service like wrapper.service.consul it gets resolved and goes to port 80 instead of 8000.

What am i missing here?


Solution

  • You have to ask DNS specifically for the port number... it's an SRV request.

    by default DNS queries are A(or AAA for ipv6) queries, and you just get the IP address.

    try asking for the SRV record directly like so:

    dig SRV wrapper.service.consul