TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The life of a DNS query in Kubernetes

18 pointsby pulover 2 years ago

2 comments

dpifkeover 2 years ago
Minor nit: in the diagram labeled &quot;the flow of a DNS query in Kubernetes,&quot; it says a DNS query is a syscall. That is incorrect: DNS lookups happen in userspace, not the kernel.<p>This is usually by calling a library function in libc, but sometimes not. For example, most programs written in Go (such as Kubernetes itself) use their own resolver instead of <a href="https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;getaddrinfo.3.html" rel="nofollow">https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;getaddrinfo.3.html</a> (or its predecessor, <a href="https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;gethostbyname.3.html" rel="nofollow">https:&#x2F;&#x2F;www.man7.org&#x2F;linux&#x2F;man-pages&#x2F;man3&#x2F;gethostbyname.3.ht...</a>). This can lead to &quot;fun&quot; issues where the behavior between resolvers diverges, such as <a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;15419">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;15419</a>.
评论 #34095903 未加载
评论 #34097564 未加载
bogomipzover 2 years ago
The author states:<p>&gt;&quot;When a pod performs a DNS lookup, the query is first sent to the local DNS resolver in the pod. This resolver uses the resolv.conf configuration file. In this file, the nodelocaldns server is set up as the default recursive DNS resolver, which acts as a cache.&quot;<p>and then:<p>&gt;&quot;Here&#x27;s the TLDR. When a pod performs a DNS lookup, the query is first sent to the DNS cache on the node where the pod is running. If the cache does not contain the IP address for the requested hostname, the query is forwarded to the cluster DNS server.&quot;<p>It&#x27;s somewhat bizarre to include an optional add-on component such a node-local DNS as part of a discussion about the default name resolution flow in Kubernetes. It is only towards the end of the post that the author mentions that node-local DNS is not actually a default component in Kubernetes.