Just a generic question about this. I saw this command in a tutorial but I’m not sure why it’s there?
swapoff -a && sed -i ‘/ swap / s/^/#/’ /etc/fstab
Just a generic question about this. I saw this command in a tutorial but I’m not sure why it’s there?
swapoff -a && sed -i ‘/ swap / s/^/#/’ /etc/fstab
If you run nodes with (traditional to-disk) swap, you lose a lot of the isolation properties that make sharing machines viable. You have no predictability around performance or latency or IO.
The discussion about this is in this issue https://github.com/kubernetes/kubernetes/issues/53533
To complete the @thockin comment, as the doc precise as a requirement at the beginning of the Installing kubeadm process:
You MUST disable swap in order for the kubelet to work properly.
I would add this command to be totally sure everything is disabled:
# First diasbale swap
sudo swapoff -a
# And then to disable swap on startup in /etc/fstab
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
Swap support is actually in the works, but there will be some caveats with running it enabled. For details check out KEP-2400: Node system swap support.
do I need to swap off on worker nodes as well? or just on Master node?
you should swap off all nodes