0

It seems I must run sudo swapoff -a command everytime I want to run kubectl commands because if I don't do that it gives me such a following error:

The connection to the server 192.168.1.2:6443 was refused - did you specify the right host or port?

Is there a way to do that permanently and getting ride of always running sudo swapoff -a command?

1
  • Do you have enabled the swap to the kubernetes Master nodes and worker nodes? If I remember correctly, one of k8s installation requirements is to disable the swap to the nodes.
    – igiannak
    Dec 14, 2022 at 11:39

2 Answers 2

1

In order to disable the swap to a Linux machine, you have to elevate with root and edit /etc/fstab.
From there, remove the swap entry by commenting it out.
Upon reboot, swap will not mount.

2
  • I have done this before but still my Kubernetes doesn't work. Dec 14, 2022 at 21:52
  • ok. can you post your cat /etc/fstab and df outputs before do swapoff -a ?
    – igiannak
    Dec 15, 2022 at 8:37
0

This error is not only related to the swapfile.

It comes also as soon you join an additional node and you dont have a network fabric installed.

Like flannel https://github.com/flannel-io/flannel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.