Custom DNS forwarding settings

How to Configure upstream DNS servers for Kubernetes DNS?

By default, Kublr imports the content of node /etc/resolv.conf to pod resolver configuration.
Using pod dnsPolicy paramerer, you can control precedence of node resolver settings and Kubernetes DNS service. See Pod’s DNS Policy for more information.

Sometimes, relying on host resolver settings is not convenient or not possible. In this case you need to set upstream name servers (so called DNS forwarders) for Kubernetes cluster-level DNS service.

In Kublr 1.11.2 and later you can set upstream DNS servers using custom cluster spec.

  1. Before starting the cluster creation, open the cluster specification by clicking the ‘Customize cluster specification’. Cluster spec editor opens.
  2. Add the following block to spec yaml data:

    spec:
      network:
        upstreamNameservers:
          - 8.8.8.8
          - 8.8.8.4
  3. Customize other spec parameters if necessary.

  4. Start cluster creation using ‘Create cluster’ button in the editor panel.

To verify that settings were applied successfully, check the logs of kubedns container in kube-dns… pod in kube-system namespace. Actual pod name is generated by Kubernetes and looks like hexadecimal hash value. Log can be accessed using Kubernetes Dashboard or kubectl commands:

# find kube-dns pod name
kubectl get pods -n kube-system | grep kube-dns
kubectl logs -n kube-system kube-dns[pod name] kubedns

Log must contain messages like:

Updated upstreamNameservers to [8.8.8.8, 8.8.8.4]
I0225 10:05:32.359143       1 dns.go:184] Configuration updated: {TypeMeta:{Kind: APIVersion:} Federations:map[] StubDomains:map[] UpstreamNameservers:[8.8.8.8, 8.8.8.4]}

Warning: Do not use addresses from 127.0.0.0/8 network for upstreamNameservers, because node local interface is not accessible to Kubernetes DNS pod.