Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
localhost.<dns-search-path> DNS records trick etcd into attempting to bind to unavailable, non-loopback IP address #57709
Is this a BUG REPORT or FEATURE REQUEST?:
I set up a cluster using kubeadm
etcd in the image gcr.io/google_containers/etcd-amd64 fails to start, producing the following output:
What you expected to happen:
I expected the etcd pod to correctly listen on a loopback IP address, not some external IP address.
How to reproduce it (as minimally and precisely as possible):
Add a DNS record to your local DNS server mapping the domain name "localhost." to a non-loopback IP.
For example, if you have "example.local" as a search path, then add a DNS A record for "localhost.example.local" pointing to some IP (10.168.91.198 in this example).
Anything else we need to know?:
This is caused by a combination of contributing factors. Firstly, etcd uses "localhost" for default URLs, not loopback addresses, and this is not going to change (etcd-io/etcd#9070) so "localhost" needs to be resolved via /etc/hosts.
Secondly, DNS resolution is prioritized over /etc/hosts due to the way that Go handles hostname resolution in GODEBUG=netdns=go mode.
Workaround: For anyone running into this issue, you can set
@andremarianiello: Reiterating the mentions to trigger a notification:
Maybe this issue happens because the etcd tries to resolve localhost with dns and not with the /etc/hosts files. We have got the same issue and tried your config which works fine. After a while we tried to resolve localhost with dns and there was a dns entry to an other server ;-). So etcd tried to bind to this address. We did not check again if this was the problem but we will try the next time and report...
and you should get the address of the kubernetes master server...