From 7e3cda445185fd50d6472cf3d9f50dff6151f635 Mon Sep 17 00:00:00 2001 From: daanh432 <8281824+daanh432@users.noreply.github.com> Date: Thu, 2 Feb 2023 00:14:30 +0100 Subject: [PATCH 1/3] Added extra overrides --- roles/k3s/master/templates/k3s.service.j2 | 2 +- roles/k3s/master/templates/vip.yaml.j2 | 6 +++--- roles/k3s/node/templates/k3s.service.j2 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/k3s/master/templates/k3s.service.j2 b/roles/k3s/master/templates/k3s.service.j2 index ae5cb484e..18896f541 100644 --- a/roles/k3s/master/templates/k3s.service.j2 +++ b/roles/k3s/master/templates/k3s.service.j2 @@ -7,7 +7,7 @@ After=network-online.target Type=notify ExecStartPre=-/sbin/modprobe br_netfilter ExecStartPre=-/sbin/modprobe overlay -ExecStart=/usr/local/bin/k3s server {{ extra_server_args | default("") }} +ExecStart=/usr/local/bin/k3s server --advertise-port={{ apiserver_advertise_port | default("6443") }} {{ extra_server_args | default("") }} KillMode=process Delegate=yes # Having non-zero Limit*s causes performance problems due to accounting overhead diff --git a/roles/k3s/master/templates/vip.yaml.j2 b/roles/k3s/master/templates/vip.yaml.j2 index 2629398dd..0a569f758 100644 --- a/roles/k3s/master/templates/vip.yaml.j2 +++ b/roles/k3s/master/templates/vip.yaml.j2 @@ -31,9 +31,9 @@ spec: - name: port value: "6443" - name: vip_interface - value: {{ flannel_iface }} + value: {{ kube_vip_iface | default(flannel_iface) }} - name: vip_cidr - value: "{{ apiserver_endpoint | ansible.utils.ipsubnet | ansible.utils.ipaddr('prefix') }}" + value: "{{ kube_vip_endpoint | default(apiserver_endpoint) | ansible.utils.ipsubnet | ansible.utils.ipaddr('prefix') }}" - name: cp_enable value: "true" - name: cp_namespace @@ -51,7 +51,7 @@ spec: - name: vip_retryperiod value: "2" - name: address - value: {{ apiserver_endpoint }} + value: {{ kube_vip_endpoint | default(apiserver_endpoint) }} image: ghcr.io/kube-vip/kube-vip:{{ kube_vip_tag_version }} imagePullPolicy: Always name: kube-vip diff --git a/roles/k3s/node/templates/k3s.service.j2 b/roles/k3s/node/templates/k3s.service.j2 index 67abadbb5..894b3890b 100644 --- a/roles/k3s/node/templates/k3s.service.j2 +++ b/roles/k3s/node/templates/k3s.service.j2 @@ -7,7 +7,7 @@ After=network-online.target Type=notify ExecStartPre=-/sbin/modprobe br_netfilter ExecStartPre=-/sbin/modprobe overlay -ExecStart=/usr/local/bin/k3s agent --server https://{{ apiserver_endpoint | ansible.utils.ipwrap }}:6443 --token {{ hostvars[groups['master'][0]]['token'] | default(k3s_token) }} {{ extra_agent_args | default("") }} +ExecStart=/usr/local/bin/k3s agent --server https://{{ apiserver_endpoint | ansible.utils.ipwrap }}:{{ apiserver_advertise_port | default("6443") }} --token {{ hostvars[groups['master'][0]]['token'] | default(k3s_token) }} {{ extra_agent_args | default("") }} KillMode=process Delegate=yes # Having non-zero Limit*s causes performance problems due to accounting overhead From ee9713de9414b92ec83b71b4ccc92057856c7c67 Mon Sep 17 00:00:00 2001 From: daanh432 <8281824+daanh432@users.noreply.github.com> Date: Thu, 2 Feb 2023 01:06:48 +0100 Subject: [PATCH 2/3] Added example config --- inventory/sample/group_vars/all.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/all.yml b/inventory/sample/group_vars/all.yml index 8815a59c7..8a2c18ae9 100644 --- a/inventory/sample/group_vars/all.yml +++ b/inventory/sample/group_vars/all.yml @@ -11,7 +11,16 @@ system_timezone: "Your/Timezone" flannel_iface: "eth0" # apiserver_endpoint is virtual ip-address which will be configured on each master -apiserver_endpoint: "192.168.30.222" +apiserver_endpoint: "10.66.10.1" + +# (optional) apiserver_advertise_port is the port on which nodes and servers will try to contact each other +# apiserver_advertise_port: 6443 + +# (optional) kube_vip_iface is an optional override for the network interface kube-vip will ARP announce +# kube_vip_iface: "eth0" + +# (optional) kube_vip_endpoint is an optional override for the internal listening endpoint for the kube-vip interface +# kube_vip_endpoint: "10.66.1.5" # k3s_token is required masters can talk together securely # this token should be alpha numeric only From 3132ec8282d14509fbdce4d3808ff687c5bfcb03 Mon Sep 17 00:00:00 2001 From: daanh432 <8281824+daanh432@users.noreply.github.com> Date: Thu, 2 Feb 2023 01:07:15 +0100 Subject: [PATCH 3/3] Reverted ip change --- inventory/sample/group_vars/all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/all.yml b/inventory/sample/group_vars/all.yml index 8a2c18ae9..e857f6274 100644 --- a/inventory/sample/group_vars/all.yml +++ b/inventory/sample/group_vars/all.yml @@ -11,7 +11,7 @@ system_timezone: "Your/Timezone" flannel_iface: "eth0" # apiserver_endpoint is virtual ip-address which will be configured on each master -apiserver_endpoint: "10.66.10.1" +apiserver_endpoint: "192.168.30.222" # (optional) apiserver_advertise_port is the port on which nodes and servers will try to contact each other # apiserver_advertise_port: 6443