简体   繁体   English

带有 kubespray 的 k8s 在 dns 配置中失败

[英]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我的带有 kubespray 的 k8s 总是在出现以下错误"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.在我的 cluster.yml 我有这个- hosts - docker_dns_servers_strict: no但我仍然收到错误。 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.如此处所述,请检查您的 yaml 文件的格式。

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 .如果在运行 kubespray 角色之前在服务器上配置一组 dns 服务器,通常会发生这种情况。

In my case I added docker_dns_servers_strict: false in the all.yaml file.就我而言,我在all.yaml文件中添加了docker_dns_servers_strict: false It's solved my problem.它解决了我的问题。

below worked for my installation by trimming the nameserver to max 6下面通过将名称服务器修剪为最大 6 来为我的安装工作

added it in roles/container-engine/docker/tasks/set_facts_dns.yml just below trim the nameserver将它添加到角色/容器引擎/docker/tasks/set_facts_dns.yml正下方修剪名称服务器

- 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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