Adding firewalld and SELinux configuration for Kubernetes in configure_node_for_k8s

This commit is contained in:
Bradley Bickford 2024-09-24 19:19:05 -04:00
parent 64bf05138e
commit 14c76fc7b6
2 changed files with 35 additions and 3 deletions

View File

@ -1,9 +1,9 @@
[masters] [masters]
KubeMaster ansible_host=192.168.100.2 KubeMaster ansible_host=192.168.100.2 master=true
[workers] [workers]
KubeWorker1 ansible_host=192.168.100.3 KubeWorker1 ansible_host=192.168.100.3 worker=true
KubeWorker2 ansible_host=192.168.100.4 KubeWorker2 ansible_host=192.168.100.4 worker=true
[ansible] [ansible]
Ansible ansible_host=192.168.100.5 Ansible ansible_host=192.168.100.5

View File

@ -16,6 +16,38 @@
persistent: present persistent: present
state: present state: present
- name: Set SELinux to Permissive
ansible.posix.selinux:
state: disabled
- name: Set firewalld configuration | Master Nodes
ansible.posix.firewalld:
port: "{{ item }}"
permanent: true
state: enabled
loop:
- "6443/tcp"
- "2379-2380/tcp"
- "10250/tcp"
- "10251/tcp"
- "10259/tcp"
- "10257/tcp"
- "179/tcp"
- "4789/udp"
when: master | default(false)
- name: Set firewalld configuration | Worker Nodes
ansible.posix.firewalld:
port: "{{ item }}"
permanent: true
state: enabled
loop:
- "179/tcp"
- "10250/tcp"
- "30000-32767/tcp"
- "4789/udp"
when: worker | default(false)
- name: Create network settings configuration file - name: Create network settings configuration file
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: "/etc/sysctl.d/99-kubernetes-cri.conf" path: "/etc/sysctl.d/99-kubernetes-cri.conf"