From 7a40d6f2ae9a8151f545e746dbd98e8db70317fc Mon Sep 17 00:00:00 2001 From: Clement Gautier Date: Thu, 12 Aug 2021 16:24:42 +0200 Subject: [PATCH 1/2] Add way to configure KubeProxy configuration --- defaults/main.yml | 2 ++ templates/kubeadm-kubelet-config.j2 | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index c8d68a0..803f51d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -48,6 +48,8 @@ kubernetes_config_cluster_configuration: podSubnet: "{{ kubernetes_pod_network.cidr }}" kubernetesVersion: "{{ kubernetes_version_kubeadm }}" +kubernetes_config_kube_proxy_configuration: {} + kubernetes_apiserver_advertise_address: '' kubernetes_version_kubeadm: 'stable-{{ kubernetes_version }}' kubernetes_ignore_preflight_errors: 'all' diff --git a/templates/kubeadm-kubelet-config.j2 b/templates/kubeadm-kubelet-config.j2 index 3fc30fd..7c4318b 100644 --- a/templates/kubeadm-kubelet-config.j2 +++ b/templates/kubeadm-kubelet-config.j2 @@ -6,9 +6,15 @@ kind: InitConfiguration kind: ClusterConfiguration apiVersion: kubeadm.k8s.io/v1beta2 {{ kubernetes_config_cluster_configuration | to_nice_yaml }} ---- {% if kubernetes_config_kubelet_configuration|length > 0 %} +--- apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration {{ kubernetes_config_kubelet_configuration | to_nice_yaml }} {% endif %} +{% if kubernetes_config_kube_proxy_configuration|length > 0 %} +--- +apiVersion: kubeproxy.config.k8s.io/v1alpha1 +kind: KubeProxyConfiguration +{{ kubernetes_config_kube_proxy_configuration | to_nice_yaml }} +{% endif %} From 830b35f047890ad235b15c90c3ac08b54fe1dcd3 Mon Sep 17 00:00:00 2001 From: Clement Gautier Date: Mon, 16 Aug 2021 11:32:38 +0200 Subject: [PATCH 2/2] Document kube_proxy_configuration --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 24caa86..e633bb7 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ NOTE: This is the recommended way to do the kubelet-configuration. Most command- NOTE: The recommended cgroupDriver depends on your [Container Runtime](https://kubernetes.io/docs/setup/production-environment/container-runtimes). When using this role with containerd instead of docker, this value should be changed to `systemd`. + kubernetes_config_kube_proxy_configuration: {} + +Options under `kind: KubeProxyConfiguration`. + ### Variables to configure kubeadm and kubelet through command-line-options kubernetes_kubelet_extra_args: ""