From 3065c9ab1a47030c690a342f01f9d95ade62ae23 Mon Sep 17 00:00:00 2001 From: Stella Alice Schlotter Date: Mon, 17 Jun 2024 10:55:35 +0200 Subject: [PATCH] add another option to disable allocating pod_cidrs --- inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml | 3 +++ .../control-plane/templates/kubeadm-config.v1beta3.yaml.j2 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml b/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml index 6bcdde8cb..f7c6db03d 100644 --- a/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml +++ b/inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml @@ -374,3 +374,6 @@ kubeadm_patches: # Set to true to remove the role binding to anonymous users created by kubeadm remove_anonymous_access: false + +# disable allocating pod cidrs by the controller manager +set_node_cidrs: false \ No newline at end of file diff --git a/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 b/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 index 0eb746aef..eccc1b0b5 100644 --- a/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 +++ b/roles/kubernetes/control-plane/templates/kubeadm-config.v1beta3.yaml.j2 @@ -306,7 +306,7 @@ controllerManager: cluster-cidr: "{{ kube_pods_subnet }}{{ ',' + kube_pods_subnet_ipv6 if enable_dual_stack_networks else '' }}" {% endif %} service-cluster-ip-range: "{{ kube_service_addresses }}{{ ',' + kube_service_addresses_ipv6 if enable_dual_stack_networks else '' }}" -{% if kube_network_plugin is defined and kube_network_plugin == "calico" and not calico_ipam_host_local %} +{% if kube_network_plugin is defined and kube_network_plugin == "calico" and not calico_ipam_host_local or set_node_cidrs is defined and not set_node_cidrs "%} allocate-node-cidrs: "false" {% else %} {% if enable_dual_stack_networks %}