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
pull/3477/head
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

@ -53,7 +53,7 @@ Kubernetes needs some parameters in order to get deployed. These are the
following default cluster paramters:
* *cluster_name* - Name of cluster (default is cluster.local)
* *domain_name* - Name of cluster DNS domain (default is cluster.local)
* *dns_domain* - Name of cluster DNS domain (default is cluster.local)
* *kube_network_plugin* - Plugin to use for container networking
* *kube_service_addresses* - Subnet for cluster IPs (default is
10.233.0.0/18). Must not overlap with kube_pods_subnet

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
}

View File

@ -97,6 +97,9 @@ spec:
- --dns-port=10053
- --config-dir=/kube-dns-config
- --v={{ kube_log_level }}
{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
- --nameservers={{ upstream_dns_servers|join(',') }}
{% endif %}
env:
- name: PROMETHEUS_PORT
value: "10055"