Kubernetes Connection error

6/8/2018

I have installed the kubernetes as per the document and I am using Mac V10.13

while I run kubectl version or kubectl cluster-info

I get this error:

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

I've looked many solutions but didn't fine one working, does anyone got the solution for this?

-- Harpreet Singh
google-kubernetes-engine
kubernetes

1 Answer

6/8/2018

Each time you run Kubectl you have to configure the admin.conf:

sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

source: https://github.com/kubernetes/kubernetes/issues/23726

-- elia
Source: StackOverflow