【发布时间】:2026-02-10 08:50:01
【问题描述】:
我正在本地网络中的某个树莓派 4 上运行 k3s 集群。我在主节点上有一个 DNS 服务器 (dnsmasq)。我希望我的集群的 pod 通过 coredns 使用该 DNS 服务器。但是,当我从 pod 中 ping 一个地址时,我总是通过 google DNS 服务器并超越我的本地 DNS 规则。
apiVersion: v1
kind: ConfigMap
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 . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
这是我的 coredns 配置。如您所见,有forward . /etc/resolv.conf
我的 /etc/resolv.conf
domain home
nameserver 127.0.0.1
有什么建议吗?
【问题讨论】:
-
这个文件 /etc/resolv.conf 来自哪里? Pod 还是主机?
-
此文件来自主机
标签: kubernetes dnsmasq coredns k3s