From d444a2fb8346a80f6307ed533ac571e099b4a19d Mon Sep 17 00:00:00 2001 From: onock <69904894+onock@users.noreply.github.com> Date: Mon, 14 Mar 2022 10:08:22 +0100 Subject: [PATCH] [systemd-resolved] Fix DNS configuration according to docs/dns-stack.md and during reset of cluster (#8560) (#8561) --- reset.yml | 1 + roles/kubernetes/preinstall/templates/resolved.conf.j2 | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/reset.yml b/reset.yml index 80d8f158c..20015700a 100644 --- a/reset.yml +++ b/reset.yml @@ -32,4 +32,5 @@ environment: "{{ proxy_disable_env }}" roles: - { role: kubespray-defaults} + - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_early: true } - { role: reset, tags: reset } diff --git a/roles/kubernetes/preinstall/templates/resolved.conf.j2 b/roles/kubernetes/preinstall/templates/resolved.conf.j2 index 0cd28c961..cfb924e47 100644 --- a/roles/kubernetes/preinstall/templates/resolved.conf.j2 +++ b/roles/kubernetes/preinstall/templates/resolved.conf.j2 @@ -1,6 +1,10 @@ [Resolve] +{% if dns_early is sameas true and dns_late is sameas false %} +#DNS= +{% else %} DNS={{ ([nodelocaldns_ip] if enable_nodelocaldns else coredns_server )| list | join(' ') }} -FallbackDNS={{ ( nameservers|d([]) + cloud_resolver|d([])) | unique | join(' ') }} +{% endif %} +FallbackDNS={{ ( upstream_dns_servers|d([]) + nameservers|d([]) + cloud_resolver|d([])) | unique | join(' ') }} Domains={{ ([ 'default.svc.' + dns_domain, 'svc.' + dns_domain ] + searchdomains|default([])) | join(' ') }} #LLMNR=no #MulticastDNS=no