Disable SWAP
Disabling swap on K3S nodes is recommended for several reasons. Firstly, Kubernetes applications are designed to manage their own memory usage, and enabling swap can lead to unexpected performance issues and instability as the system may swap container data to disk. Secondly, disabling swap ensures that Kubernetes workloads have predictable and consistent memory behavior, helping to avoid potential problems related to excessive swap usage. Lastly, some container runtime environments, like Docker, do not handle swap well, and disabling it helps maintain compatibility and stability when running K3S clusters.
Disabling SWAP using /etc/fstab
Open /etc/fstab with editor like vim vi or nano
Locate line hat corresponds to your swap partition
/dev/sdX# none swap sw 0 0
To remove swap you can comment line (recommended), or remove the line completely from fstab
After making changes type below commands
sudo swapoff -a
It is recommended to reboot the server after make these changes
Disable using swapiness
This is another way to disable swap.
On server open /etc/sysctl.conf using editor and add 0 to swappiness
vm.swappiness=0
save changes and exit
Apply the changes by running below command
Related content
Classified as Getvisibility - Partner/Customer Confidential