mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-31 14:36:20 -02:30
refactor: extract DNS configuration from kubernetes/preinstall into dns_config role (#13603)
Extract tasks related to host DNS management from kubernetes/preinstall into a new kubernetes/dns_config role. Previously, kubernetes/preinstall was re-invoked at the end of cluster playbooks with dns_late: true to apply resolvconf changes after cluster DNS came up. Because of this reuse, several unrelated tasks in preinstall were guarded with 'when: not dns_late'. Move resolvconf, systemd-resolved, networkmanager-dns, and dhclient tasks, along with their associated templates, facts, variables, and handlers, into kubernetes/dns_config. Update cluster.yml, upgrade_cluster.yml, scale.yml, and reset.yml to invoke the new role directly and remove dns_late guards. Signed-off-by: Dasmat13 <gptdasmat@gmail.com>
This commit is contained in:
@@ -206,10 +206,11 @@ There are three modes available:
|
||||
This activates the classic Kubespray behavior that modifies the hosts ``/etc/resolv.conf`` file and dhclient
|
||||
configuration to point to the cluster dns server (either coredns or coredns_dual, depending on dns_mode).
|
||||
|
||||
As cluster DNS is not available on early deployment stage, this mode is split into 2 stages. In the first
|
||||
stage (``dns_early: true``), ``/etc/resolv.conf`` is configured to use the DNS servers found in ``upstream_dns_servers``
|
||||
and ``nameservers``. Later, ``/etc/resolv.conf`` is reconfigured to use the cluster DNS server first, leaving
|
||||
the other nameservers as backups.
|
||||
As cluster DNS is not available during early deployment, the ``kubernetes/dns_config`` role automatically
|
||||
detects whether kubelet has been configured. Before kubelet is set up, ``/etc/resolv.conf`` is configured
|
||||
to use the DNS servers found in ``upstream_dns_servers`` and ``nameservers``. After the cluster DNS is
|
||||
running, the ``kubernetes/dns_config`` role is invoked again and reconfigures ``/etc/resolv.conf`` to use
|
||||
the cluster DNS server first, leaving the other nameservers as backups.
|
||||
|
||||
Also note, existing records will be purged from the `/etc/resolv.conf`,
|
||||
including resolvconf's base/head/cloud-init config files and those that come from dhclient.
|
||||
|
||||
Reference in New Issue
Block a user