Disabling Swap on a Kubernetes Node
Starting from Platform9 Managed Kubernetes version 3.3, all Kubernetes masters and nodes are expected to have swap disabled. This is the recommended deployment per the Kubernetes community, as mentioned in the Kubernetes changelog. If swap is not disabled, kubelet service will not start on the masters and nodes, for Platform9 Managed Kubernetes version 3.3 and above.
Run the following command to disable swap immediately.
sudo swapoff -a
Run the following command to update fstab so that swap remains disabled after a reboot.
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
The aforementioned command comments out all swap entries in the /etc/fstab file.
Note: Automated deployment of Platform9 Managed Kubernetes to Amazon Web Services does not have swap enabled on nodes, by default.