Fix DNS loop when resolvconf_mode is set to host_resolvconf (#3390)

* Fix DNS loop when resolvconf_mode is set to host_resolvconf

* Make sure upstream_dns_servers is defined when using resolvconf_mode == 'host_resolvconf'

* Only set upstream dns servers on KubeDNS and CoreDNS if they are defined

* Only set upstream dns servers on KubeDNS and CoreDNS if they are defined
This commit is contained in:
Andreas Krüger
2018-10-08 16:08:51 +02:00
committed by k8s-ci-robot
parent 30132d8c35
commit 7e195b06a6
3 changed files with 12 additions and 1 deletions

View File

@@ -13,10 +13,18 @@ data:
health
kubernetes {{ dns_domain }} in-addr.arpa ip6.arpa {
pods insecure
{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
upstream {{ upstream_dns_servers|join(' ') }}
{% else %}
upstream /etc/resolv.conf
{% endif %}
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
proxy . {{ upstream_dns_servers|join(' ') }}
{% else %}
proxy . /etc/resolv.conf
{% endif %}
cache 30
}