DNS server validation fails

Installation fails at the validating DNS server stage.

Symptoms

Installation fails with the following message:

fatal: [x.x.x.x] => A loopback IP is used in your DNS server configuration. For more details, see https://ibm.biz/dns-fails.

Causes

The cluster node that is specified in the error message uses a loopback IP(127.0.0.1 or 127.0.1.1) as the DNS server. Or, the cluster node that is specified in the error message does not have a /etc/resolv.conf file.

When a loopback IP is used as the DNS server, you might experience issues when a service tries to resolve external domain from inside a container.

Resolving the problem

  1. Add the following setting to the cluster/config.yaml configuration file.

     loopback_dns: true
    
  2. Retry the installation.

  3. After you successfully install your cluster, update the kube-dns configuration.

     kubectl edit cm kube-dns --namespace=kube-system
    
         apiVersion: v1
     data:
       Corefile: |
         .:53 {
             errors
             health
             kubernetes cluster.local in-addr.arpa ip6.arpa {
                 pods insecure
                 upstream
                 fallthrough in-addr.arpa ip6.arpa
             }
             prometheus :9153
      -        proxy . /etc/resolv.conf
     +        proxy . 8.8.8.8
             cache 30
             reload
         }
     kind: ConfigMap
     metadata:
       creationTimestamp: 2018-08-22T01:54:16Z
       labels:
         addonmanager.kubernetes.io/mode: EnsureExists
         app: kube-dns
         chart: kube-dns-99.99.99
         heritage: Tiller
         release: kube-dns
       name: kube-dns
       namespace: kube-system
       resourceVersion: "6382"
       selfLink: /api/v1/namespaces/kube-system/configmaps/kube-dns
       uid: 46c0e47f-a5ae-11e8-9bba-fa163eec7c9e
    
  4. Restart the kube-dns pod to load the new configuration.

     [root@kvm-014377 ~]# kubectl get po -n kube-system |grep kube-dns
     kube-dns-ldtqc                                                1/1       Running     0          30m
     [root@kvm-014377 ~]# kubectl delete po kube-dns-ldtqc -n kube-system
     pod "kube-dns-ldtqc" deleted