How to fix: the connection to the server IP:6443 was refused – did you specify the right host or port

  kuberenetes, linux

The error:

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

sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

Also make this permanent:

echo 'export KUBECONFIG=$HOME/admin.conf' >> $HOME/.bashrc
source ~/.bashrc