curiousengineer
curiousengineer

Reputation: 2607

k8s with kubespray fails at dns config

My k8s with kubespray always bails out at the following error "Too many nameservers. You can relax this check by set docker_dns_servers_strict=no and we will only use the first 3

In my cluster.yml I have this under - hosts - docker_dns_servers_strict: no but I still get the error. What am I missing?

Upvotes: 1

Views: 1508

Answers (4)

harsha k
harsha k

Reputation: 91

below worked for my installation by trimming the nameserver to max 6

added it in roles/container-engine/docker/tasks/set_facts_dns.yml just below trim the nameserver

- name: rtrim number of numbers of search domain to 6
  set_fact:
    docker_dns_search_domains: "{{ docker_dns_search_domains[0:6] }}"
  when: docker_dns_search_domains|length > 6

Upvotes: 0

John Bob Joe
John Bob Joe

Reputation: 31

For me, it worked with adding -e 'docker_dns_servers_strict=no':

ansible-playbook -i ../inventories/kubernetes.yaml --become --become-user=root cluster.yml -e 'docker_dns_servers_strict=no'

Upvotes: 1

vg.cloudpro
vg.cloudpro

Reputation: 1

In my case I added docker_dns_servers_strict: false in the all.yaml file. It's solved my problem.

Upvotes: 0

VonC
VonC

Reputation: 1323115

As explained here, check the format of your yaml file.

Here is one example:

- hosts: k8s-cluster:etcd:calico-rr
  any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  vars:
    - docker_dns_servers_strict: no
  roles:
    - { role: kubespray-defaults}
    - { role: kernel-upgrade, tags: kernel-upgrade, when: kernel_upgrade is defined and kernel_upgrade }
    - { role: kubernetes/preinstall, tags: preinstall }
    - { role: docker, tags: docker }
    - role: rkt
      tags: rkt
      when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]"

As mentioned in this issue:

This usually happens if you configure one set of dns servers on the servers before you run the kubespray role.

Upvotes: 0

Related Questions