The connection to the server localhost:8080 was refused

kubectl interfaces with kube-apiserver for cluster management. The command works on the master node because that's where kube-apiserver runs. On the worker nodes, only kubelet and kube-proxy is running.

In fact, kubectl is supposed to be run on a client (eg. laptop, desktop) and not on the kubernetes nodes.


from master you need ~/.kube/config pass this file as argument for kubectl command. Copy the config file to other server or laptop then pass the argument as for kubectl command

eg:

kubectl --kubeconfig=~/.kube/config

Tags:

Kubernetes