So far, I have been managing Kubernetes worker nodes with Fedora CoreOS Ignition, but I have decided to move everything back to Fedora and Ansible. I like the idea of an immutable operating system, but the FCOS implementation is not really what I want. I like the automated updates, but that can be accomplished with _dnf-automatic_. I do _not_ like giving up control of when to upgrade to the next Fedora release. Mostly, I never did come up with a good way to manage application-level configuration on FCOS machines. None of my experiments (Cue+tmpl, KCL+etcd+Luci) were successful, which mostly resulted in my manually managing configuration on nodes individually. Managing OS-level configuration is also rather cumbersome, since it requires redeploying the machine entirely. Altogether, I just don't think FCOS fits with my model of managing systems. This commit introduces a new playbook, `kubernetes.yml`, and a handful of new roles to manage Kubernetes worker nodes running Fedora Linux. It also adds two new deploy scripts, `k8s-worker.sh` and `k8s-longhorn.sh`, which fully automate the process of bringing up worker nodes.
93 lines
1.9 KiB
YAML
93 lines
1.9 KiB
YAML
- name: load os-specific values
|
|
include_vars: '{{ item }}'
|
|
with_first_found:
|
|
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
|
|
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
|
|
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml'
|
|
- '{{ ansible_distribution }}.yml'
|
|
- '{{ ansible_os_family }}.yml'
|
|
- defaults.yml
|
|
tags:
|
|
- always
|
|
|
|
- name: ensure required packages are installed
|
|
dnf:
|
|
name: '{{ kubernetes_packages }}'
|
|
install_weak_deps: false
|
|
state: present
|
|
tags:
|
|
- install
|
|
|
|
- name: ensure firewalld service is stopped
|
|
service:
|
|
name: firewalld
|
|
state: stopped
|
|
enabled: false
|
|
ignore_errors: true
|
|
tags:
|
|
- firewalld
|
|
|
|
- name: ensure kernel modules-load is configured for kubernetes
|
|
copy:
|
|
content: |+
|
|
{{ kubernetes_kernel_modules | join('\n') }}
|
|
dest: /etc/modules-load.d/k8s.conf
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,go=r
|
|
notify:
|
|
- load kernel modules
|
|
tags:
|
|
- kmod
|
|
|
|
- name: ensure kernel tunables are set for kubernetes
|
|
copy:
|
|
src: sysctl.conf
|
|
dest: /etc/sysctl.d/60-k8s.conf
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,go=r
|
|
notify:
|
|
- set kernel tunables
|
|
tags:
|
|
- sysctl
|
|
|
|
- name: ensure zram generator defaults are disabled
|
|
copy:
|
|
content: ''
|
|
dest: /etc/systemd/zram-generator.conf
|
|
owner: root
|
|
group: root
|
|
mode: u=rw,go=r
|
|
notify:
|
|
- reload systemd
|
|
tags:
|
|
- zram-generator
|
|
|
|
- name: ensure zram0 is stopped
|
|
systemd:
|
|
name: systemd-zram-setup@zram0
|
|
state: stopped
|
|
ignore_errors: true
|
|
notify:
|
|
- swapoff -a
|
|
tags:
|
|
- zram-generator
|
|
|
|
- name: ensure unneeded cni configuration files are removed
|
|
file:
|
|
path: /etc/cni/net.d/{{ item }}
|
|
state: absent
|
|
loop:
|
|
- 100-crio-bridge.conflist
|
|
- 200-loopback.conflist
|
|
tags:
|
|
- cni
|
|
|
|
- name: ensure kubelet service is enabled
|
|
service:
|
|
name: kubelet
|
|
enabled: true
|
|
tags:
|
|
- service
|