【问题标题】:K8s coredns and flannel nameserver limit exceeded超出 K8s coredns 和 flannel 名称服务器限制
【发布时间】:2020-05-10 10:47:41
【问题描述】:

我一直在尝试在单个节点中设置 k8s,一切都安装得很好。但是当我检查我的 kube-system pod 的状态时,

CNI -> flannel pod has crashed, reason -> Nameserver limits were exceeded, some nameservers has been missing, apply nameserver line is: xxxx xxxx xxxx

CoreDNS pod 状态为 ContainerCreating

在我的办公室中,当前服务器已配置为具有静态 ip,当我检查 /etc/resolv.conf

这是输出

# Generated by NetworkManager
search ORGDOMAIN.BIZ
nameserver 192.168.1.12
nameserver 192.168.2.137
nameserver 192.168.2.136
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 192.168.1.10
nameserver 192.168.1.11

我无法找到根本原因,我应该查看什么?

【问题讨论】:

    标签: kubernetes flannel coredns


    【解决方案1】:

    简而言之,/etc/resolv.conf 中的条目太多。

    这是known issue

    一些 Linux 发行版(例如 Ubuntu)默认使用本地 DNS 解析器(systemd-resolved)。 Systemd-resolved 将/etc/resolv.conf 移动并替换为存根文件,该存根文件在解析上游服务器中的名称时可能导致致命的转发循环。这可以通过使用 kubelet 的--resolv-conf 标志指向正确的resolv.conf 手动修复(使用systemd-resolved,这是/run/systemd/resolve/resolv.conf)。 kubeadm (>= 1.11) 自动检测systemd-resolved,并相应地调整 kubelet 标志。

    还有

    Linux 的 libc 不可能被卡住 (see this bug from 2005),只有 3 个 DNS nameserver 记录和 6 个 DNS search 记录。 Kubernetes 需要消耗 1 条nameserver 记录和 3 条search 记录。这意味着如果本地安装已经使用了 3 个nameservers 或使用了超过 3 个searches,其中一些设置将会丢失。作为部分解决方法,节点可以运行dnsmasq,这将提供更多nameserver 条目,但不会提供更多search 条目。你也可以使用 kubelet 的 --resolv-conf 标志。

    如果您使用 Alpine 3.3 或更早版本作为基础映像,由于 Alpine 的一个已知问题,DNS 可能无法正常工作。更多信息请查看here

    您可以在 Kubernetes 代码中更改它,但我不确定功能。因为它被设置为这个值。

    代码可以定位到@​​987654324@

    const (
        // Limits on various DNS parameters. These are derived from
        // restrictions in Linux libc name resolution handling.
        // Max number of DNS name servers.
        MaxDNSNameservers = 3
        // Max number of domains in search path.
        MaxDNSSearchPaths = 6
        // Max number of characters in search path.
        MaxDNSSearchListChars = 256
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-16
      • 2021-08-29
      • 2016-03-25
      • 2019-05-24
      • 1970-01-01
      • 2019-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多