简体   繁体   中英

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?

对我来说,它与添加-e 'docker_dns_servers_strict=no'

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

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 .

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM