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

Hi I have the same problem with you,
when I restart the ubuntu,and type kubectl get nodes
It always show

change@change-VirtualBox:~$ kubectl get nodes
The connection to the server 10.0.2.15:6443 was refused - did you specify the right host or port?

and I found how to solve this question.

  1. sudo -i
  2. swapoff -a
  3. exit
  4. strace -eopenat kubectl version

and you can type kubectl get nodes again.

16 Likes