Hi, I am seeing the below error when trying to get pods from worker nodes Node01 . . .

Ashu:
Hi, I am seeing the below error when trying to get pods from worker nodes Node01 and Node02.

kubectl get nodes
The connection to the server localhost:8080 was refused - did you specify the right host or port?

Is there anything i am missing?

K8ns:
error message is expected when you run kubectl on worker node. Kubectl needs to talk to kube-api-server to fetch the requested information. kube-api-server gets it from etcd pod. Kubectl commands have to be run from master node

K8ns:
there is one workaround for it… you need to copy the ~/.kube/config file from master to worker node and then you can run the below command on worker node by passing the config file

kubectl get nodes --kubeconfig=config

Ashu:
got it. Thanks @K8ns for the explanation.
I found kubelet conf file in the node and copied to root user’s ~/.kube/config in node location.
cp /etc/kubernetes/kubelet.conf /home/vagrant/.kube/config

Mohamed Ayman:
You can only run static PODs on the worker node.