System Preparation for Kubernetes Nodes
System Preparation
Section titled “System Preparation”Disable Swap (Permanently)
Section titled “Disable Swap (Permanently)”Kubernetes requires swap to be disabled. If swap re-enables after reboot, kubelet will fail to start.
sudo swapoff -asudo sed -i '/\sswap\s/ s/^/#/' /etc/fstabcat /etc/fstab | grep swapfree -hLoad Kernel Modules
Section titled “Load Kernel Modules”cat <<EOF | sudo tee /etc/modules-load.d/k8s.confoverlaybr_netfilterEOF
sudo modprobe overlaysudo modprobe br_netfilterConfigure Sysctl
Section titled “Configure Sysctl”cat <<EOF | sudo tee /etc/sysctl.d/k8s.confnet.bridge.bridge-nf-call-iptables = 1net.bridge.bridge-nf-call-ip6tables = 1net.ipv4.ip_forward = 1EOF
sudo sysctl --systemIncrease Inotify Limits
Section titled “Increase Inotify Limits”sudo sysctl -w fs.inotify.max_user_instances=512sudo sysctl -w fs.inotify.max_user_watches=524288echo "fs.inotify.max_user_instances=512" | sudo tee /etc/sysctl.d/99-inotify.confecho "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.d/99-inotify.conf