Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改 nodelocaldns 上游 dns 配置 #1210

Merged
merged 12 commits into from
Dec 19, 2022
Merged

修改 nodelocaldns 上游 dns 配置 #1210

merged 12 commits into from
Dec 19, 2022

Conversation

itswl
Copy link
Contributor

@itswl itswl commented Dec 16, 2022

ipvs 模式下,修改 nodelocaldns 上游 dns 为 kube-dns 的地址

@gjmzj
Copy link
Collaborator

gjmzj commented Dec 18, 2022

why,我没找到哪里有文档讨论这个配置修改的意义

@itswl
Copy link
Contributor Author

itswl commented Dec 19, 2022

PILLAR__UPSTREAM__SERVERS 这个值在iptables 时,监听的是 kube-dns 服务的 IP 地址, ipvs 时默认是 /etc/resolv.conf。 一般都没有搭建自定义dns, 改成 coreDNS 可以让 coreDNS 作为 nodelocaldns 的上游服务器,在 cornDNS 做 hosts解析可以生效。

@itswl
Copy link
Contributor Author

itswl commented Dec 19, 2022

coredns/coredns#3298

https://github.com/kubernetes-sigs/kubespray/blob/ef76a578a46660a098a7b2343990d5b7bdce4b40/roles/kubernetes-apps/ansible/tasks/nodelocaldns.yml

参考 kubespray
upstreamForwardTarget: >-
{%- if upstream_dns_servers is defined and upstream_dns_servers|length > 0 -%}
{{ upstream_dns_servers|join(' ') }}
{%- else -%}
/etc/resolv.conf
{%- endif -%}

就是nodelocaldns 不支持 rewrite 与 hosts ,coredns 添加 hosts 解析是不生效的。有 dns 服务器话这里可以改成 dns 服务器的地址,没有的话这里改成 coredns 的地址也可以 解析 corndns cm 中添加的hosts

@gjmzj gjmzj merged commit 42949cb into easzlab:master Dec 19, 2022
kubeasz pushed a commit that referenced this pull request Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants