Skip to content

Commit 4a35717

Browse files
Merge pull request #190 from strelok899/adding-IPVS-option
Adding-IPVS-option
2 parents 8d68186 + 3bf1b22 commit 4a35717

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ rke2_kubevip_image: ghcr.io/kube-vip/kube-vip:v0.6.4
8585
# Specify which image is used for kube-vip cloud provider container
8686
rke2_kubevip_cloud_provider_image: ghcr.io/kube-vip/kube-vip-cloud-provider:v0.0.4
8787

88+
# Enable kube-vip IPVS load balancer for control plane
89+
rke2_kubevip_ipvs_lb_enable: false
90+
# Enable layer 4 load balancing for control plane using IPVS kernel module
91+
# Must use kube-vip version 0.4.0 or later
92+
8893
# (Optional) A list of kube-vip flags
8994
# All flags can be found here https://kube-vip.io/docs/installation/flags/
9095
# rke2_kubevip_args: []

defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ rke2_kubevip_image: ghcr.io/kube-vip/kube-vip:v0.6.4
4646
# Specify which image is used for kube-vip cloud provider container
4747
rke2_kubevip_cloud_provider_image: ghcr.io/kube-vip/kube-vip-cloud-provider:v0.0.4
4848

49+
# Enable kube-vip IPVS load balancer for control plane
50+
rke2_kubevip_ipvs_lb_enable: false
51+
# Enable layer 4 load balancing for control plane using IPVS kernel module
52+
# Must use kube-vip version 0.4.0 or later
53+
54+
4955
# (Optional) A list of kube-vip flags
5056
# All flags can be found here https://kube-vip.io/docs/installation/flags/
5157
# rke2_kubevip_args: []

tasks/main.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
when:
2222
- rke2_ha_mode | bool
2323

24+
- name: Enable IPVS kernel module
25+
community.general.modprobe:
26+
name: ip_vs
27+
state: present
28+
persistent: present
29+
when:
30+
- rke2_kubevip_ipvs_lb_enable | bool
31+
- inventory_hostname in groups[rke2_servers_group_name]
32+
- rke2_ha_mode | bool
33+
- rke2_ha_mode_kubevip | bool
34+
- not rke2_ha_mode_keepalived | bool
35+
36+
2437
- name: Copy kube-vip manifests to the masternode
2538
ansible.builtin.include_tasks: kubevip.yml
2639
when:

templates/kube-vip/kube-vip.yml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ spec:
6262
value: "{{ rke2_api_ip }}"
6363
- name: prometheus_server
6464
value: :2112
65+
- name: lb_enable
66+
value: "{{ rke2_kubevip_ipvs_lb_enable }}"
6567
{% if rke2_kubevip_args is defined %}
6668
{% for item in rke2_kubevip_args %}
6769
- name: {{ item.param }}

0 commit comments

Comments
 (0)