The connection to the server localhost:8080 was refused, after a "kubectl get pods --all-namespaces"

Hello, people appologies in advance I’m an absolute Kubernetes newb and not especially a linux expert. Background is as a VMware admin. Just completed a kubernetes master build on ubuntu as per the below guide …

https://linuxconfig.org/how-to-install-kubernetes-on-ubuntu-20-04-focal-fossa-linux

Unfortuately however I have come up to the first hurdle after runnign a “kubectl get pods --all-namespaces”

I get the below output …

“The connection to the server localhost:8080 was refused”

Any idea’s where I have gone wrong? …

I had a similar issue just recently and while searching for solutions i believe after you ran this command
kubernetes-master:~$ sudo kubeadm init then you ran the following three commands as admin (sudo), which you should not have done and instead run them with normal user. The solution to this is to do a reset kubeadm reset and then run the above command with sudo following the three commands they mention at the end as a normal user.
I installed my kubernetes cluster two days ago and i used this video https://www.youtube.com/watch?v=UWg3ORRRF60 It works fine.

Dam I just used Sudo for everything, studidly assumed it would be best