Kubernetes connection error in Mac

7/31/2018

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?

-- user10147267
docker
kubernetes
macos

2 Answers

8/19/2018

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

-- sethmccombs
Source: StackOverflow

12/3/2018

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

-- dodSps
Source: StackOverflow