Ever Annoying localhost:8080 error

Hello Everyone,

I do not understand why this is happening, there is really no reason for it I have done exactly what was in the step by step tuorial.

I have a dashboard token (this works fine), and then I run a command to try and do something and I get the localhost:8080 connection refused error why is kubernetes so hard to get installed and working?

Here is a command that is not difficult:
ubuntu@kmaster:~ kubectl get secrets The connection to the server localhost:8080 was refused - did you specify the right host or port? ubuntu@kmaster:~ sudo kubectl get secrets
The connection to the server localhost:8080 was refused - did you specify the right host or port?

I tried to do this just a few minutes ago:
curl -L https://downloads.portainer.io/portainer-agent-k8s-nodeport.yaml -o portainer-agent-k8s.yaml; kubectl apply -f portainer-agent-k8s.yaml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1612 100 1612 0 0 3124 0 --:–:-- --:–:-- --:–:-- 3117

and got the following:
The connection to the server localhost:8080 was refused - did you specify the right host or port?

I have checked the .kube/config file to make sure everything is correct and it is not sure what to look for now…

Thanks in advance,
Michael

Hi @nexusguy59
That error i see is normally linked to missing kubeconfig, either it doesn’t exist in the default path like $HOME/.kube/config or the environment variable KUBECONFIG doesn’t exist
if you try this microk8s kubectl apply .... does it work?
If you want to use your local kubectl export the kubeconfig from MicroK8s like this microk8s config > $HOME/.kube/config.

1 Like

Thank you, I do appreciate it very much. I will give it shot.

Michael

It’s working now I forgot to run one command to get it there.

Thanks,
Michael