feat(ansible)!: set sysctls for kubernetes
This file is renamed from 99-kubernetes-cri.conf to 99-kubernetes.conf and also includes disabling rp_filter https://github.com/charmed-kubernetes/layer-kubernetes-node-base/pull/2
This commit is contained in:
1 parent
b92dda91f5
commit
3f0cd41151
1 file changed
+16
-23
@@ -21,27 +21,20 @@
|
|||||||
ff02::2 ip6-allrouters
|
ff02::2 ip6-allrouters
|
||||||
ff02::3 ip6-allhosts
|
ff02::3 ip6-allhosts
|
||||||
|
|
||||||
- name: Check for bridge-nf-call-iptables
|
- name: Set system controls for Kubernetes
|
||||||
ansible.builtin.stat:
|
ansible.posix.sysctl:
|
||||||
path: /proc/sys/net/bridge/bridge-nf-call-iptables
|
name: "{{ item.key }}"
|
||||||
register: bridge_nf_call_iptables_result
|
value: "{{ item.value }}"
|
||||||
|
sysctl_file: /etc/sysctl.d/99-kubernetes.conf
|
||||||
|
reload: true
|
||||||
|
with_dict: "{{ sysctl_config }}"
|
||||||
|
vars:
|
||||||
|
sysctl_config:
|
||||||
|
net.ipv4.ip_forward: 1
|
||||||
|
net.ipv4.conf.all.forwarding: 1
|
||||||
|
net.ipv6.conf.all.forwarding: 1
|
||||||
|
net.bridge.bridge-nf-call-iptables: 1
|
||||||
|
net.bridge.bridge-nf-call-ip6tables: 1
|
||||||
|
net.ipv4.conf.default.rp_filter: 0
|
||||||
|
net.ipv4.conf.all.rp_filter: 0
|
||||||
|
|
||||||
- name: Set Kubernetes network configuration
|
|
||||||
ansible.builtin.blockinfile:
|
|
||||||
path: /etc/sysctl.d/99-kubernetes-cri.conf
|
|
||||||
mode: 0644
|
|
||||||
create: true
|
|
||||||
block: |
|
|
||||||
net.ipv4.ip_forward = 1
|
|
||||||
net.bridge.bridge-nf-call-iptables = 1
|
|
||||||
net.ipv6.conf.all.forwarding = 1
|
|
||||||
net.bridge.bridge-nf-call-ip6tables = 1
|
|
||||||
when:
|
|
||||||
- bridge_nf_call_iptables_result.stat.exists
|
|
||||||
register: sysctl_network
|
|
||||||
|
|
||||||
- name: Reload Kubernetes network configuration
|
|
||||||
ansible.builtin.shell: sysctl -p /etc/sysctl.d/99-kubernetes-cri.conf
|
|
||||||
when:
|
|
||||||
- sysctl_network.changed
|
|
||||||
- bridge_nf_call_iptables_result.stat.exists
|
|
||||||
Reference in new issue
Block a user