I cannot load the node information on kubernetes

10/22/2020

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,

-- sclee1
kubernetes

2 Answers

10/22/2020

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.

-- Justin Tamblyn
Source: StackOverflow

10/22/2020

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.

  1. Check kubelet is running on node bistelresearchdev-dn03 with systemctl status kubelet

  2. Check network plugin is installed on your cluster.

-- Sachin Arote
Source: StackOverflow