Also add the system nameservers to upstream servers in dnsmasq

Also make no-resolv unconditional again. Otherwise, we may end up in
a resolver loop. The resolver loop was the cause for the piling up
parallel queries.
This commit is contained in:
Alexander Block 2017-02-07 11:54:07 +01:00
parent 94c1b09ebd
commit 94d9f03ddb
2 changed files with 17 additions and 4 deletions

View file

@ -11,6 +11,20 @@
state: directory state: directory
tags: bootstrap-os tags: bootstrap-os
- name: check system nameservers
shell: awk '/^nameserver/ {print $NF}' /etc/resolv.conf
changed_when: False
register: system_nameservers
- name: init system_and_upstream_dns_servers
set_fact:
system_and_upstream_dns_servers: "{{ upstream_dns_servers|default([]) }}"
- name: combine upstream_dns_servers and system nameservers (only for docker_dns)
set_fact:
system_and_upstream_dns_servers: "{{ system_and_upstream_dns_servers | union(system_nameservers.stdout_lines) | unique }}"
when: system_nameservers.stdout != "" and resolvconf_mode != 'host_resolvconf'
- name: Write dnsmasq configuration - name: Write dnsmasq configuration
template: template:
src: 01-kube-dns.conf.j2 src: 01-kube-dns.conf.j2

View file

@ -11,20 +11,19 @@ server=/{{ dns_domain }}/{{ skydns_server }}
local=/{{ bogus_domains }} local=/{{ bogus_domains }}
#Set upstream dns servers #Set upstream dns servers
{% if upstream_dns_servers is defined %} {% if system_and_upstream_dns_servers|length > 0 %}
{% for srv in upstream_dns_servers %} {% for srv in system_and_upstream_dns_servers %}
server={{ srv }} server={{ srv }}
{% endfor %} {% endfor %}
no-resolv
{% elif resolvconf_mode == 'host_resolvconf' %} {% elif resolvconf_mode == 'host_resolvconf' %}
{# The default resolver is only needed when the hosts resolv.conf was modified by us. If it was not modified, we can rely on dnsmasq to reuse the systems resolv.conf #} {# The default resolver is only needed when the hosts resolv.conf was modified by us. If it was not modified, we can rely on dnsmasq to reuse the systems resolv.conf #}
server={{ default_resolver }} server={{ default_resolver }}
no-resolv
{% endif %} {% endif %}
{% if kube_log_level == '4' %} {% if kube_log_level == '4' %}
log-queries log-queries
{% endif %} {% endif %}
no-resolv
bogus-priv bogus-priv
no-negcache no-negcache
cache-size={{ cache_size }} cache-size={{ cache_size }}