[dns] resolution fails on linux if running avahi-daemon
samschlegel opened this issue · comments
If running avahi on Linux, it seems that it takes priority over the cluster.local.
stub. dig
works fine as that bypasses mDNS. Disabling avahi fixes name resolution.
I rely on it for printing and connecting to some servers on my LAN, so while disabling it unblocked running kwt
, it's not a long term solution.
i see.
looks like currently i only enable mdns on os x:
https://github.com/k14s/kwt/blob/01506ff961c116370c4c7ceed1f6067d9630df57/pkg/kwt/cmd/net/dns_flags.go#L32 which controls https://github.com/k14s/kwt/blob/01506ff961c116370c4c7ceed1f6067d9630df57/pkg/kwt/cmd/net/dns_factory.go#L45
can you try running kwt net start
command with --dns-mdns=true
flag while avahi is running?
Hmm. kwt
picks up the mdns requests and answers about 20 times, but curl still errors due to not being able to resolve the host. avahi-resolve -n
also times out.
I could debug with Wireshark or something later, but for now I just adjusted my /etc/nsswitch.conf
to not include [NOTFOUND=return]
after mdns_minimal
in order for it to fall back to DNS. Might also try using the built-in mDNS in systemd-resolved
I fixed it by moving the "dns" flag before the "mdns" flag in the /etc/nsswitch.conf. My "hosts" entry in that file now looks like this:
hosts: files dns mdns4_minimal [NOTFOUND=return] myhostname
@phluks Thanks for this, your solution works for me.
For passers-by, make sure that you have your hostname at the of the end line
@cppforlife thanks for bringing my attention to this issue in particular and thanks for the k14s in general. Brilliant work.