mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2025-12-25 18:23:05 +01:00
Compare commits
4 Commits
c6f4f38a5d
...
5d4e24283e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d4e24283e | ||
|
|
c86cbb9fbc | ||
|
|
f3b88a7ea4 | ||
|
|
edf0c9eebd |
@@ -13,6 +13,7 @@ container_iface: "eth0"
|
|||||||
# set use_calico to true to use tigera operator/calico instead of the default CNI flannel
|
# set use_calico to true to use tigera operator/calico instead of the default CNI flannel
|
||||||
# install reference: https://docs.tigera.io/calico/latest/getting-started/kubernetes/k3s/multi-node-install#install-calico
|
# install reference: https://docs.tigera.io/calico/latest/getting-started/kubernetes/k3s/multi-node-install#install-calico
|
||||||
use_calico: false
|
use_calico: false
|
||||||
|
calico_ebpf: false # use eBPF dataplane instead of iptables https://docs.tigera.io/calico/latest/operations/ebpf
|
||||||
calico_cidr: "10.52.0.0/16" # pod cidr pool
|
calico_cidr: "10.52.0.0/16" # pod cidr pool
|
||||||
calico_tag: "v3.27.0" # calico version tag
|
calico_tag: "v3.27.0" # calico version tag
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
state: stopped
|
state: stopped
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
|
# k3s-init won't work if the port is already in use
|
||||||
|
- name: Stop k3s
|
||||||
|
systemd:
|
||||||
|
name: k3s
|
||||||
|
state: stopped
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
- name: Clean previous runs of k3s-init # noqa command-instead-of-module
|
- name: Clean previous runs of k3s-init # noqa command-instead-of-module
|
||||||
# The systemd module does not support "reset-failed", so we need to resort to command.
|
# The systemd module does not support "reset-failed", so we need to resort to command.
|
||||||
command: systemctl reset-failed k3s-init
|
command: systemctl reset-failed k3s-init
|
||||||
@@ -29,7 +36,7 @@
|
|||||||
-p Restart=on-failure \
|
-p Restart=on-failure \
|
||||||
--unit=k3s-init \
|
--unit=k3s-init \
|
||||||
k3s server {{ server_init_args }}"
|
k3s server {{ server_init_args }}"
|
||||||
creates: "{{ systemd_dir }}/k3s.service"
|
creates: "{{ systemd_dir }}/k3s-init.service"
|
||||||
|
|
||||||
- name: Verification
|
- name: Verification
|
||||||
when: not ansible_check_mode
|
when: not ansible_check_mode
|
||||||
|
|||||||
@@ -95,5 +95,17 @@
|
|||||||
- { name: calico-apiserver, type: deployment, selector: 'k8s-app=calico-apiserver', namespace: calico-apiserver }
|
- { name: calico-apiserver, type: deployment, selector: 'k8s-app=calico-apiserver', namespace: calico-apiserver }
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.type }}/{{ item.name }}"
|
label: "{{ item.type }}/{{ item.name }}"
|
||||||
|
|
||||||
|
- name: Patch Felix configuration for eBPF mode
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: >
|
||||||
|
kubectl patch felixconfiguration default
|
||||||
|
--type='merge'
|
||||||
|
--patch='{"spec": {"bpfKubeProxyIptablesCleanupEnabled": false}}'
|
||||||
|
register: patch_result
|
||||||
|
changed_when: "'felixconfiguration.projectcalico.org/default patched' in patch_result.stdout"
|
||||||
|
failed_when: "'Error' in patch_result.stderr"
|
||||||
|
when: calico_ebpf == true
|
||||||
|
|
||||||
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname']
|
||||||
run_once: true # stops "skipped" log spam
|
run_once: true # stops "skipped" log spam
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ spec:
|
|||||||
nodeSelector: {{ calico_nodeSelector if calico_nodeSelector is defined else 'all()' }}
|
nodeSelector: {{ calico_nodeSelector if calico_nodeSelector is defined else 'all()' }}
|
||||||
nodeAddressAutodetectionV4:
|
nodeAddressAutodetectionV4:
|
||||||
interface: {{ container_iface if container_iface is defined else 'eth0' }}
|
interface: {{ container_iface if container_iface is defined else 'eth0' }}
|
||||||
|
linuxDataplane: {{ 'BPF' if calico_ebpf else 'Iptables' }}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user