Unable to use kubectl to administer cluster - "failed to negotiate an api version"

9/3/2016

I'm trying to use kubectl locally after creating a cluster via the cloud console but I keep getting an error. Below are the steps I took:

Via Cloud Console

gcloud containers cluster create test

Locally

gcloud container clusters get-credentials test

kubectl cluster-info

I'm getting the following error:

error: failed to negotiate an api version; server supports: map[], client supports: map[componentconfig/v1alpha1:{} rbac.authorization.k8s.io/v1alpha1:{} authentication.k8s.io/v1beta1:{} apps/v1alpha1:{} batch/v1:{} authorization.k8s.io/v1beta1:{} autoscaling/v1:{} batch/v2alpha1:{} v1:{} extensions/v1beta1:{} policy/v1alpha1:{} federation/v1beta1:{}]

Below is the output of kubectl version

Client Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.5", GitCommit:"b0deb2eb8f4037421077f77cb163dbb4c0a2a9f5", GitTreeState:"clean", BuildDate:"2016-08-11T20:29:08Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"windows/amd64"}

Below is extracted from from the output of kubectl cluster-info --v=8

212 request.go:891] Response Body: Forbidden: "/api"

Any help is greatly appreciated

-- Dale Alleshouse
gcloud
kubectl
kubernetes

2 Answers

9/5/2016

I finally figured out a work around. I have two sets of authorizations set up on my local machine, I selected one of them by using:

gcloud config set account

gcloud config set project

gcloud container get-credentials

The steps above result in the error shown in the original question. If I take the steps below, it will work:

gcloud auth login

gcloud config set project

gcloud container get-credentials

So, I guess auth login does something that config set account is not doing. Does anyone have any insight?

-- Dale Alleshouse
Source: StackOverflow

9/3/2016

Run again with --v=8 to see a trace of all the network calls

-- Jordan Liggitt
Source: StackOverflow