gpt4 book ai didi

networking - K3S Rancher - 基于 Debian 的 docker 镜像无法正确解析 dns

转载 作者:行者123 更新时间:2023-12-03 19:09:23 25 4
gpt4 key购买 nike

我面临着奇怪的问题。
我所做的:
我部署了 Rancher K3S 集群,并且在使用基于 debian 的图像解析 dns 时存在问题。域未正确解析 - 它使用我们的域之一为其添加后缀。
我发现了什么:
基于 Debian 的镜像 在末尾添加带有域的后缀。例如我 ping google.com 和它的 ping google.com.example.com。 (example.com 是我们的域之一 - 不指定它,因为它并不重要 imo)
curl google.com 同样向 example.com 的 IP 地址发出请求。即使尝试过纯 debian 镜像,它仍然存在同样的问题。
基于 Alpine 的图像 工作正常(ping google.com ping google.com,nslookup 显示正确的IP 地址)。
主机服务器 安装 k3s 的地方也可以正常工作(redhat os)。 ping google.com ping google.com。
一些可能对您有所帮助的其他数据:
CoreDNS 配置映射
kubectl -n kube-system get configmap coredns -o go-template={{.data.Corefile}}

.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
}
hosts /etc/coredns/NodeHosts {
reload 1s
fallthrough
}
prometheus :9153
forward . 8.8.8.8
cache 30
loop
reload
loadbalance
}
有没有人遇到相同或类似的问题?
你有什么观点可以促使我解决问题吗?
谢谢,
大卫

最佳答案

我遇到了类似的问题 k3s (v.v1.19.3+k3s3) 在 centos 8(虽然不太确定它与图像的操作系统有什么关系)。 k3smicrok8s 之类的其他发行版相比,即插即用功能更少.
使用本地 DNS 参数
在每个节点上,您可以说要使用主机的解析参数。如 k3s管理为 systemd 服务 (可能是这种情况),您可以编辑 /etc/systemd/system/k3s.service.env添加您系统的 resolv.conf

K3S_RESOLV_CONF=/etc/resolv.conf
然后重启服务
sudo systemctl status k3s
  • :最简单的解决方案,易于编写脚本
  • 缺点 :您需要在每个节点上执行此操作(据我所知)。不同 resolv.conf在不同的系统上,根据 kube 使用的节点,相同的部署可能不会以相同的方式运行

  • relevant documentation
    使用全局 DNS
    没试过,但这里是 the doc

    关于networking - K3S Rancher - 基于 Debian 的 docker 镜像无法正确解析 dns,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62635732/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com