liveBook · Manning

Dns policy

As explained in Kubernetes in Action, Second Edition

A Kubernetes DNS policy specifies how a pod obtains and prioritizes DNS configuration.

A Kubernetes DNS policy controls how a pod receives and prioritizes DNS configuration. The default, ClusterFirst, tries cluster DNS before the node’s DNS settings. section 11.1.3

Choose a policy according to the pod’s networking needs:

  • ClusterFirst uses the internal cluster DNS first, then the node’s DNS configuration. section 11.1.3
  • Default uses the DNS configuration of the node. section 11.1.3
  • None provides no Kubernetes-managed DNS configuration; configure the pod through dnsConfig. section 11.1.3
  • ClusterFirstWithHostNet supports special pods using the host’s network. 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

Inspecting /etc/resolv.conf reveals the search domains, cluster DNS nameserver, and resolver options that result from the pod’s DNS configuration. section 11.1.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines four policy values and links them to resolv.conf generation, while deferring detailed dnsConfig options.
Examples
Uses a pod’s resolv.conf to show search domains, the cluster DNS nameserver, and resolver options.
What you can do after
Operate/configure it by selecting a pod dnsPolicy and, when needed, supplying custom dnsConfig settings.
How it connects
Connects pod DNS policy with cluster DNS, resolv.conf, dnsConfig, node DNS, and host networking.

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.