liveBook · Manning

CoreDNS

As explained in Kubernetes in Action, Second Edition

CoreDNS is an extensible DNS server commonly deployed in Kubernetes clusters to provide service and pod name resolution.

CoreDNS commonly provides the internal DNS service in a Kubernetes cluster. Pods use it to resolve Service names into cluster IP addresses, so applications can connect without hard-coding those addresses. section 11.1.3

A Service can be resolved using progressively more specific DNS names:

  • <service-name> works when the Service is in the pod’s namespace. section 11.1.3
  • <service-name>.<namespace> works from any namespace; longer forms append .svc and the cluster domain. section 11.1.3
  • The default cluster domain is cluster.local, but the cluster can configure a different suffix. section 11.1.3

Connecting to a Service by name

A pod can call the quiz Service with curl http://quiz when both are in the same namespace, or curl http://quiz.kiada from another namespace. The pod’s /etc/resolv.conf points to the cluster DNS Service and supplies search domains that make short names work. section 11.1.3

/ # cat /etc/resolv.conf
search kiada.svc.cluster.local svc.cluster.local cluster.local localdomain
nameserver 10.96.0.10
options ndots:5

Inspect a pod’s resolver configuration to see its search domains and the cluster DNS nameserver. section 11.1.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains lookup names and resolver configuration, but stops short of CoreDNS implementation internals.
Examples
Demonstrates curl requests to quiz, cross-namespace names such as quiz.kiada, and pod resolver settings.
What it assumes
Assumes basic pods and Services while showing how namespaces and resolver search paths affect lookups.
What you can do after
Apply it via Service DNS names to connect applications without embedding cluster IP addresses.
How it connects
Connects Kubernetes pods, Services, namespaces, cluster IP addresses, and DNS search domains.

Also explained in

Compare how 2 books explain CoreDNS →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.