企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# coredns forward 在k8s 中 依赖coredns 做service name 服务的DNS 解析。在实际生产中如果有我们的服务依赖自己的私有私有域名(.aliyun.ftc.dianrong.io) 可在coredns 添加转发功能,由自建Bind 完成DNDS 域名解析。 ### 修改coredns configmap cat coredns-config.yml --- apiVersion: v1 kind: ConfigMap metadata: name: coredns namespace: kube-system labels: addonmanager.kubernetes.io/mode: EnsureExists data: Corefile: | .:53 { errors health kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure upstream /etc/resolv.conf fallthrough in-addr.arpa ip6.arpa } prometheus :9153 proxy . /etc/resolv.conf cache 30 } .aliyun.ftc.dianrong.io { forward . 10.34.11.10 } ### kubernetes 1.14.X --- apiVersion: v1 kind: ConfigMap metadata: name: coredns namespace: kube-system labels: addonmanager.kubernetes.io/mode: EnsureExists data: Corefile: | .:53 { errors health kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure upstream 172.16.20.132 172.16.20.133 # /etc/resolv.conf 文件修改成上游dns 地址 fallthrough in-addr.arpa ip6.arpa } prometheus :9153 proxy . 172.16.20.132 172.16.20.133 # /etc/resolv.conf 文件修改成上游dns 地址 cache 30 loop reload loadbalance } 参考文档 [k8s官方文档 dns 转发策略说明](https://kubernetes.io/cn/docs/tasks/administer-cluster/dns-custom-nameservers/) [coredns forward 官方文档](https://coredns.io/explugins/forward/)