summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2023-05-16 20:44:28 +0200
committerChristian Pointner <equinox@spreadspace.org>2023-05-16 20:44:28 +0200
commit823c9dff3b9b89bd6a8be0186c8302286e743ae1 (patch)
treea12fa347796e1575d5e16f6a9be59c4553e14caf /roles/kubernetes/kubeadm
parentcosmetic fixes (diff)
kubernetes: implement kube-proxy in ipvs mode
Diffstat (limited to 'roles/kubernetes/kubeadm')
-rw-r--r--roles/kubernetes/kubeadm/base/tasks/main.yml11
-rw-r--r--roles/kubernetes/kubeadm/control-plane/templates/kubeadm-init.config.j26
2 files changed, 17 insertions, 0 deletions
diff --git a/roles/kubernetes/kubeadm/base/tasks/main.yml b/roles/kubernetes/kubeadm/base/tasks/main.yml
index 75c1187a..e339fbcb 100644
--- a/roles/kubernetes/kubeadm/base/tasks/main.yml
+++ b/roles/kubernetes/kubeadm/base/tasks/main.yml
@@ -72,3 +72,14 @@
- name: prepare network plugin
include_tasks: "net_{{ kubernetes_network_plugin }}.yml"
+
+- name: install extra packages for kube-proxy ipvs mode
+ when:
+ - not kubernetes_network_plugin_replaces_kube_proxy
+ - kubernetes_kube_proxy_mode is defined
+ - kubernetes_kube_proxy_mode == 'ipvs'
+ apt:
+ name:
+ - ipvsadm
+ - ipset
+ state: present
diff --git a/roles/kubernetes/kubeadm/control-plane/templates/kubeadm-init.config.j2 b/roles/kubernetes/kubeadm/control-plane/templates/kubeadm-init.config.j2
index 9aba276c..3f6794dc 100644
--- a/roles/kubernetes/kubeadm/control-plane/templates/kubeadm-init.config.j2
+++ b/roles/kubernetes/kubeadm/control-plane/templates/kubeadm-init.config.j2
@@ -58,3 +58,9 @@ cgroupDriver: systemd
clusterDNS:
- "{{ kubernetes_nodelocal_dnscache_ip }}"
{% endif %}
+{% if not kubernetes_network_plugin_replaces_kube_proxy and kubernetes_kube_proxy_mode is defined %}
+---
+apiVersion: kubeproxy.config.k8s.io/v1alpha1
+kind: KubeProxyConfiguration
+mode: {{ kubernetes_kube_proxy_mode }}
+{% endif %}