05. November 2019 1 min read

How to set persistent swapoff for Kubernetes kubelet

When you first restart your Kubernetes node or master you usually bump into

failed to run Kubelet: running with swap on is not supported, please disable swap! or set --fail-swap-on 

Sounds quite obvious that the solution is in fact:

sudo swapoff -a

It is worth mentioning that swapoff command is not persistent on RaspberryPi, Ubuntu, etc. whereever systemd is having a go over reboots. To make it completely persistent just disable execution of the dphys-swapfile

sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo chmod -x /etc/init.d/dphys-swapfile
# unregister swap also from systemd
sudo systemctl disable dphys-swapfile

Newest from this category: