Adding some stuff to manage fedora based kubernetes nodes

This commit is contained in:
Bradley Bickford 2024-09-28 10:15:13 -04:00
parent 971685294c
commit 351ab77607
4 changed files with 87 additions and 5 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "c:\\Program Files\\Python312\\python.exe"
}

View File

@ -1,9 +1,9 @@
[masters] [masters]
KubeMaster ansible_host=192.168.100.2 master=true kubemaster ansible_host=192.168.100.2 master=true
[workers] [workers]
KubeWorker1 ansible_host=192.168.100.3 worker=true kubeworker1 ansible_host=192.168.100.3 worker=true
KubeWorker2 ansible_host=192.168.100.4 worker=true 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 connection=local

View File

@ -0,0 +1,79 @@
---
- hosts: masters,workers
become: true
become_method: sudo
become_user: root
tasks:
- name: Stop and disable zram generator
ansible.builtin.service:
name: "swap-create@zram0"
enabled: false
state: stopped
- name: Remove zram generator defaults
ansible.builtin.yum:
name: "zram-generator-defaults"
state: absent
- name: Reboot the system to get rid of the zram swap that's already been set up
ansible.builtin.reboot:
reboot_timeout: 900
- name: Set SELinux to Permissive
ansible.posix.selinux:
state: permissive
- name: Disable firewalld
ansible.builtin.service:
name: firewalld
enabled: false
state: stopped
- name: Install iptables components
ansible.builtin.yum:
name:
- iptables
- iproute-tc
state: present
- name: Add overlay modprobe module
community.general.modprobe:
name: overlay
persistent: present
state: present
- name: Add br_netfilter module
community.general.modprobe:
name: br_netfilter
persistent: present
state: present
- name: Create network settings configuration file
ansible.builtin.blockinfile:
path: "/etc/sysctl.d/99-kubernetes-cri.conf"
block: |
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
create: true
- name: Apply new sysctl settings
ansible.builtin.shell:
cmd: sysctl --system
changed_when: false
- name: Install cri-o and kubernetes
ansible.builtin.yum:
name:
- cri-o
- containernetworking-plugins
- kubernetes
- kubernetes-kubeadm
- kubernetes-client
state: present
- name: Enable and start cri-o
ansible.builtin.service:
name: crio
enabled: true
state: started

View File

@ -18,7 +18,7 @@
- name: Set SELinux to Permissive - name: Set SELinux to Permissive
ansible.posix.selinux: ansible.posix.selinux:
state: disabled state: permissive
- name: Set firewalld configuration | Master Nodes - name: Set firewalld configuration | Master Nodes
ansible.posix.firewalld: ansible.posix.firewalld: