When I ran the command below, I got the below messages
bistel@BISTelResearchDev-DN03:~$ kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?
While in the master node, I get the information as below:
bistel@BISTelResearchDev-NN:/etc/kubernetes$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
bistelresearchdev-dn03 NotReady <none> 62s v1.19.3
bistelresearchdev-nn Ready master 57m v1.19.3
bistel@BISTelResearchDev-NN:/etc/kubernetes$
The bistelresearchdev-dn03
is the worker node and the message appears when I ran any command using kubectl
as follows The connection to the server localhost:8080 was refused - did you specify the right host or port?
.
I googled it a lot but any trials didn't work for me.
Thanks,
The first computer you ran on is missing the kube config file.
Normally kubectl expects to find it at ~/.kube/config
If you get the one off the master node and copy it onto your machine your kubectl will see it and be able to use it.
kubectl
works only on master node in cluster. If you are getting this error then there is no issue.
I can see the issue here is node is NotReady
status for that you can check below things.
Check kubelet is running on node bistelresearchdev-dn03
with systemctl status kubelet
Check network plugin is installed on your cluster.