You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recommend to use getent ahosts NAME instead of dig +short NAME in this course, for both: manual steps in the documentation and scripts.
getent is a tool usually included into even very minimalistic OS setup.
getent follows /etc/nsswitch.conf rules (reads /etc/hosts, mDNS, etc.), while dig is mainly designed to troubleshoot external DNS servers. Much more details about the difference can be found in https://unix.stackexchange.com/questions/20784/ (or in my brief summary).
I think using dig is a bad practice when custom records in /etc/hosts are used. getent is designed for such cases.
I'm currently in step 08 and I see no issues with this replacement.
Also I've checked: using getent ahosts is compatible with both Vagrant images, Ubuntu and Debian, to do steps of this course.
I'm using dig +short because it returns only the IP address with no need to muck about with awk to get it. getent will return IP+HOST
The lab's not millisecond performance critical so if dig does waste time getting a negative response from DNS before checking hosts file, not really an issue.
I'm using dig +short because it returns only the IP address with no need to muck about with awk to get it. getent will return IP+HOST
I agree, I have to use getent ahosts example.com | awk '{ print $1 ; exit }' to return only one IP-address without name.
The lab's not millisecond performance critical so if dig does waste time getting a negative response from DNS before checking hosts file, not really an issue.
The thing is — dig doesn't use /etc/hosts at all. In case of the lab, I think that systemd-resolved is doing that.
This change is also about to teach people to use proper tools.
vazhnov
added a commit
to vazhnov/kubernetes-the-hard-way__vagrant
that referenced
this issue
Dec 18, 2024
Hello!
Thank you for the project!
I recommend to use
getent ahosts NAME
instead ofdig +short NAME
in this course, for both: manual steps in the documentation and scripts.getent
is a tool usually included into even very minimalistic OS setup.getent
follows/etc/nsswitch.conf
rules (reads/etc/hosts
, mDNS, etc.), whiledig
is mainly designed to troubleshoot external DNS servers. Much more details about the difference can be found in https://unix.stackexchange.com/questions/20784/ (or in my brief summary).I think using
dig
is a bad practice when custom records in/etc/hosts
are used.getent
is designed for such cases.I'm currently in step 08 and I see no issues with this replacement.
Also I've checked: using
getent ahosts
is compatible with both Vagrant images, Ubuntu and Debian, to do steps of this course.Currently script vagrant/ubuntu/update-dns.sh fails to apply in Debianlet's skip this for dedicated issue.The text was updated successfully, but these errors were encountered: