Reputation: 73
OS : OSX (mac)
Docker : 18.06.0-ce (edge)
Kubernetes : 1.10.3
I use Kubernetes for the first time.
I tried Google but could not find the manual for Kubernetes, which operates on the Mac.
Running kubectl version
outputs The connection to the
server localhost:8080 was refused - did you specify the right host or port?
Upvotes: 4
Views: 8447
Reputation: 2662
For my part, Kubernetes was not enabled within Docker Desktop.
Here's how to enable Kubernetes on Mac:
Upvotes: 0
Reputation: 11
You might notice this error The connection to the server localhost:8080 was refused - did you specify the right host or port?
because of your local minikube server might be down.
You have to start the existing minikube instance using - minikube start (I'm assuming your local minikube configured with docker driver earlier like: minikube start --driver=docker
)
If not working above step then you have to delete the existing minikube then start it again:
minikube delete
minikube start --driver=docker
Upvotes: 1
Reputation: 112
I came across this issue when changing from minikube to the Docker Desktop supplied Kubernetes. For me, the issue was caused by a stale .kube configuration. Posting my workaround here as this was the first result I found on google when looking to troubleshoot the issue.
I had originally installed with homebrew: brew uninstall minikube
. If installed using other methods, go back to your install source for uninstall info.
After minikube was uninstalled, I restarted my machine which may or may not have been necessary but it is what I did.
ls -al
and look for .kube
and .minikube
..kube
settings: rm -rf ./.kube
..minikube
settings: rm -rf ./.minikube
.ls -al
and make sure the .kube
and .minikube
directories have been deleted.kubectl version
. You should see info for Client Version and Server Version if everything worked.Upvotes: 5
Reputation: 43
I had faced the same issue and my user id did not had the admin privileges, once the chown is done, Kubernetes started working.Hope this helps
Upvotes: 0
Reputation: 91
When you run kubectl
, the .kube/config
file is read in your home directory, thus telling which cluster you want to connect to using --context=<cluster-name>
What your error output is telling you is that it is unable to find a listening kubernetes
API endpoint upon which to run those commands. It is looking for a cluster at localhost:8080
This endpoint will vary depending on how and where you installed Kubernetes. How are you running Kubernetes?
Are you using the bundled Docker/Kubernetes for Mac as mentioned here? - Docker for Mac Kubernetes or are you using a tool like MiniKube? - MiniKube
Upvotes: 2