When you apply this manifest file, it will create a daemonset which will run a pod on each node to serve as an agent that runs CoreDNS with hostNetwork:True option (creates an interface with a default IP of 169.254.20.10/32) and caches the DNS queries.
It queries ClusterDNS Service for cache misses.
Using the NodeLocal DNSCache helps to avoid iptable DNAT rules and connections tracking, which improves DNS performance and reduces the average DNS lookup time.
One of the significant advantages of using NodeLocal DNSCache is that you can upgrade to TCP for DNS queries which improve reliability.
Different that the general caching mechanisms, it can do Negative Caching! Even if you have a failed resolving action of a domain, it can cache this and avoid querying the ClusterDNS Service.
Using NodeLocal DNSCache give us metrics and creates visibility on Node level!
And last but not least, pods don’t need to be modified to use it!!
NodeLocal DNSCluster was available starting with Kubernetes 1.15 in beta and with Kubernetes version 1.18, it is graduated from beta to GA!
Please give it a go and let us know if you have questions!
Onur is a software developer & architect for 17+ years and has been working with AWS professionally for 5 years. Currently working as a Software Architect and DevOps Consultant at kloia, he has built many infrastructures on AWS for cloud-born applications and has migrated various projects to AWS. He has consulted across different industries and companies during their journey on AWS. He is a Kubernetes lover and believes in the principle of 'Everything as Code'