Additional Os Configuration

disable swap

Kubernetes required that any swap partitions are disabled and will not work if enabled. Run the following commands to disable

sudo swapoff -a  # Disable swap without restarting
sudo sed -i '/ swap / s/^/#/' /etc/fstab  # Comment out any swap lines in /etc/fstab
cat /etc/fstab # Validate that swap lines are commented out

Enable required kernel modules

Run the following commands to enable the br_netfilter kernel module

sudo mkdir /etc/modules-load.d/
sudo modprobe br_netfilter
echo 'br_netfilter' | sudo tee -a /etc/modules-load.d/k8s.conf
cat <<EOF | sudo tee -a /etc/sysctl.d/10-k8s.conf
net.ipv4.ip_forward=1
net.bridge.bridge-nf-call-iptables=1
EOF
sudo sysctl --system # Apply changes without reboot

Configure containerd

cat <<EOF | sudo tee -a /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
EOF
sudo sed -i 's/^disabled_plugins \=/\#disabled_plugins \=/g' /etc/containerd/config.toml
sudo systemctl restart containerd