From eb73f1d27d9ac5a68e216c4da315617dc9abf493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=97=AD?= Date: Thu, 14 Dec 2023 17:03:34 +0800 Subject: [PATCH] support disable dns autoscaler when use CoreDNS (#10608) --- roles/kubernetes-apps/ansible/tasks/coredns.yml | 2 ++ roles/kubespray-defaults/defaults/main/main.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/roles/kubernetes-apps/ansible/tasks/coredns.yml b/roles/kubernetes-apps/ansible/tasks/coredns.yml index d8f854774..a5f7b198c 100644 --- a/roles/kubernetes-apps/ansible/tasks/coredns.yml +++ b/roles/kubernetes-apps/ansible/tasks/coredns.yml @@ -21,6 +21,7 @@ when: - dns_mode in ['coredns', 'coredns_dual'] - inventory_hostname == groups['kube_control_plane'][0] + - enable_dns_autoscaler or item.name != 'dns-autoscaler' tags: - coredns @@ -40,5 +41,6 @@ when: - dns_mode == 'coredns_dual' - inventory_hostname == groups['kube_control_plane'][0] + - enable_dns_autoscaler or item.name != 'dns-autoscaler' tags: - coredns diff --git a/roles/kubespray-defaults/defaults/main/main.yml b/roles/kubespray-defaults/defaults/main/main.yml index 611947595..a18505bcb 100644 --- a/roles/kubespray-defaults/defaults/main/main.yml +++ b/roles/kubespray-defaults/defaults/main/main.yml @@ -99,6 +99,9 @@ docker_dns_options: # Can be coredns, coredns_dual, manual, or none dns_mode: coredns +# Enable dns autoscaler +enable_dns_autoscaler: true + # Enable nodelocal dns cache enable_nodelocaldns: true enable_nodelocaldns_secondary: false