Kubenetes gcloud container engine get-credential error

10/8/2016

I am trying to connect Google Container Engine from my local machine using gcloud sdk but i am getting below error.

C:\Program Files (x86)\Google\Cloud SDK>gcloud container clusters get-credential
s cluster-2  --zone us-central1-a --project myapp-00000
Fetching cluster endpoint and auth data.
ERROR: (gcloud.container.clusters.get-credentials) environment variable HOME or
KUBECONFIG must be set to store credentials for kubectl

I have check at HOME location there is not .kube folder created and not environment variable set by default, so i have created KUBECONFIG environment by myself after that i am getting below error :-

ERROR: gcloud crashed (OSError): [Errno 13] Permission denied: 'C:\\Tool\\config'

i have started gcloud sdk as admin and it have all the correct Permission.

EDIT

I am using below version (which are latest as of today)

Google Cloud SDK 129.0.0
kubectl
kubectl-windows-x86_64 1.4.0
C:\Program Files (x86)\Google\Cloud SDK>kubectl version
Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.0",
-- Anchit Pancholi
gcloud
google-app-engine
google-kubernetes-engine
kubernetes

2 Answers

5/20/2017

I had the same issue. It turns out that KUBECONFIG refers to a file and not to a directory.

So if you set up KUBECONFIG to 'C:\Tool\config\kubectl.cfg' it should work fine.

-- Jean-Francois Gillot
Source: StackOverflow

10/10/2016

I take it you set KUBECONFIG env to 'C:\Tool\config'? That error is gcloud failing to write due to missing admin privileges; I don't know if you need to run the shell as admin. You might also try the HOME directory. Note that gcloud will attempt to create any missing directories on the path to the kubeconfig file.

-- jeffml
Source: StackOverflow