Error: The connection to the server localhost:8080 was refused

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.25.4
Cloud being used: local
Installation method: Installing APP
Host OS: MacOS

Sorry, for being a little bit off-topic, because maybe its a little bit unofficial here.
I’m trying to get Kubernetes running on Docker Desktop for local development.

When I do kubectl cluster-info I get:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
This usually points on error with Kubernetes’s config file missing. My guess was confirmed with: kubectl config view , which did empty result:

apiVersion: v1
clusters: null
contexts: null
current-context: ""
kind: Config
preferences: {}
users: null

I checked that config file still resides at my user folder “.kube/config”. Setting appropriate environment variables makes the things working until reboot: export KUBECONFIG=/Users/Me/.kube/config, so I’m getting the right info via kubectl cluster-info, but on the next reboot I need to write it again.

Which thing do I need to change in Kubernetes or maybe in MacOS to get the config-file work without every time assigning environment variables?

Thank you!