Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consul does not resolve CNAME to A-record for local service #1228

Closed
nilsotto opened this issue Sep 10, 2015 · 16 comments
Closed

consul does not resolve CNAME to A-record for local service #1228

nilsotto opened this issue Sep 10, 2015 · 16 comments
Labels
type/bug Feature does not function as expected
Milestone

Comments

@nilsotto
Copy link

When registering an external service in the catalog (https://www.consul.io/docs/guides/external.html), consul returns a CNAME-record on the dns-interface.
Adding the recursors config option makes consul resolve the A-record an return that as well.

However, consul should always resolve CNAMEs for internal services.

example
consul 0.5.2, started like this :
consul agent --client 0.0.0.0 --server --data-dir . --bootstrap-expect 1

(Using httpie as a curl alternative:)

$  http PUT :8500/v1/agent/service/register << EOF
 {
   "ID": "srvtest1",
   "Name": "srvtest1",
   "Tags": [
     "master",
     "v1"
   ],
   "Address": "127.0.0.1",
   "Port": 8000
 } 
EOF

$ http PUT :8500/v1/catalog/register << EOF
 {
    "Datacenter": "dc1", 
    "Node": "aliastest",
    "Address": "srvtest1.service.consul",
    "Service": {
            "Service": "srvalias1", 
            "Port": 80
            }
 }
EOF

This registers the internal service srvtest1.service.consul and the alias srvalias1.service.consul

When querying the consul DNS for the alias, i would expect the CNAME to be resolved, but it is not.

$ dig @localhost -p 8600 srvalias1.service.consul 
---- snip ----
;; ANSWER SECTION:
srvalias1.service.consul. 0 IN  CNAME   srvtest1.service.consul.

However, when I start consul with the parameter --recursor localhost:8600, the CNAME is resolved to its correct A record

$ dig @localhost -p 8600 srvalias1.service.consul 

---- snip ----
;; ANSWER SECTION:
srvalias1.service.consul. 0 IN  CNAME   srvtest1.service.consul.
srvtest1.service.consul. 0  IN  A   127.0.0.1

expected behaviour
Consul should consider if the external service is on the local domain and resolve CNAME->A accordingly without consiguring a recursor,

@DanyC97
Copy link

DanyC97 commented Sep 15, 2015

+1

@cdosso
Copy link

cdosso commented Oct 5, 2015

Enabling --recursor localhost:8600 gives me tons of errors like this in logs:

2015/10/05 15:16:12 [ERR] dns: recurse failed: read udp 127.0.0.1:8600: i/o timeout

Btw cname resolution works but with 100% CPU usage 👎 Any idea?

@slackpad slackpad added the type/enhancement Proposed improvement or new feature label Nov 16, 2015
@slackpad
Copy link
Contributor

Hi @cdosso can you provide an example that gets into this state? Your issue should probably be filed separately from this one, which looks like an enhancement.

@goacid
Copy link

goacid commented Nov 24, 2015

+1 @nilsotto
Adding --recursor do not fix for me :
Consul v0.5.2
Consul Protocol: 2 (Understands back to: 1)

@Nomon
Copy link

Nomon commented Nov 25, 2015

+1

@goacid
Copy link

goacid commented Jan 14, 2016

label enhancement seems not appropriate. Without recurse DNS is not usable in many cases

@slackpad slackpad added type/bug Feature does not function as expected and removed type/enhancement Proposed improvement or new feature labels Jan 14, 2016
@slackpad
Copy link
Contributor

@goacid that's fair - changing to a bug.

@nitram509
Copy link

+1

3 similar comments
@ghost
Copy link

ghost commented Jan 29, 2016

+1

@waswrongassembled
Copy link

+1

@dnltsk
Copy link

dnltsk commented Jan 30, 2016

+1

@Solisol
Copy link

Solisol commented May 10, 2016

Any progress on this issue?

@kesselborn
Copy link

same question here: any progress on this? Would be nice to remove the dnsmasq hack we currently have to use :)

@n2taylor
Copy link

n2taylor commented Sep 6, 2016

Any good workarounds for this issue that do not involve enabling recursor mode?

@kyhavlov
Copy link
Contributor

Fixed in #2444

@vtahlani
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Feature does not function as expected
Projects
None yet
Development

No branches or pull requests