CoreDNS is deployed in Container Service for Kubernetes (ACK) clusters and serves as a Domain Name System (DNS) server to provide DNS resolution services for workloads deployed in ACK clusters. This topic introduces CoreDNS and its features, and describes how CoreDNS resolves domain names in Kubernetes clusters.
Introduction to CoreDNS
CoreDNS is a DNS resolver for Kubernetes clusters. CoreDNS resolves custom internal domain names and external domain names. CoreDNS contains a variety of plug-ins. These plug-ins allow you to configure custom DNS settings and customize hosts, Canonical Name (CNAME) records, and rewrite rules for Kubernetes clusters. CoreDNS is hosted by Cloud Native Computing Foundation (CNCF), which also hosts Kubernetes. For more information about CoreDNS, see CoreDNS: DNS and Service Discovery.
- For more information about CoreDNS configurations in ACK clusters, see Configure CoreDNS for an ACK cluster.
- For more information about how to use CoreDNS to improve the performance of DNS resolutions for an ACK cluster, see Optimize DNS resolution for an ACK cluster.
You can also use NodeLocal DNSCache to improve the stability and performance of service discovery in ACK clusters. NodeLocal DNSCache improves DNS performance by running a DNS caching agent on nodes as a DaemonSet. For more information about how to deploy NodeLocal DNSCache in an ACK cluster, see Deploy Node Local DNS in an ACK cluster.
Mappings between CoreDNS versions and Kubernetes versions
DNS resolutions in an ACK cluster
The startup parameters of kubelet in an ACK cluster include
--cluster-domain=<default-local-domain>. These parameters are used to configure the IP address and the suffix of the base domain name for the DNS server in the ACK cluster.
nameserver 172.xx.x.xx search kube-system.svc.cluster.local svc.cluster.local cluster.local options ndots:5
|①||When a client pod attempts to access Service Nginx, the pod sends a request to the DNS server that is specified in the DNS configuration file /etc/resolv.conf. In this example, the DNS server address is 172.21.0.10, which is the IP address of Service kube-dns. The result of the resolution is 172.21.0.30.|
|②||The client pod sends another request to 172.21.0.30, which is the IP address of Service Nginx. Then, the request is forwarded to the backend pods Nginx-1 and Nginx-2.|
For more information about DNS resolutions in Kubernetes clusters, see Introduction and configuration of the DNS service in ACK clusters.