Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl built from head does not recognize all api versions with older server version #40813

Closed
foxish opened this issue Feb 1, 2017 · 20 comments
Assignees
Labels
area/kubectl priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Milestone

Comments

@foxish
Copy link
Contributor

foxish commented Feb 1, 2017

In case of kubectl built from head:

~/g/s/k/kubernetes (master=) kubectl.sh version
Client Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.1.160+056728067d762d", GitCommit:"056728067d762d7a7a673b2039f90529e68b78f9", GitTreeState:"clean", BuildDate:"2017-02-01T16:36:03Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"2017-01-12T04:52:34Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}


~/g/s/k/kubernetes (master=) kubectl.sh api-versions
autoscaling/v1
batch/v1
extensions/v1beta1
storage.k8s.io/v1beta1
v1

Older kubectl 1.5.2

~/g/s/k/kubernetes (master=) /usr/local/google/home/ramanathana/Install/google-cloud-sdk/bin/kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"2017-01-12T04:57:25Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"2017-01-12T04:52:34Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}


~/g/s/k/kubernetes (master=) /usr/local/google/home/ramanathana/Install/google-cloud-sdk/bin/kubectl api-versions
apps/v1beta1
autoscaling/v1
batch/v1
extensions/v1beta1
policy/v1beta1
storage.k8s.io/v1beta1
v1

cc @kubernetes/sig-cli-bugs @pwittrock @ymqytw

@foxish foxish added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Feb 1, 2017
@foxish foxish added this to the 1.6 milestone Feb 1, 2017
@mengqiy
Copy link
Member

mengqiy commented Feb 1, 2017

Why using kubectl.sh. What is the difference between it and kubectl binary?
It works on my end:

$ kubectl api-versions 
apps/v1beta1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1beta1
autoscaling/v1
batch/v1
box-pki.com/v1
certificates.k8s.io/v1beta1
company.com/v1
extensions/v1beta1
policy/v1beta1
rbac.authorization.k8s.io/v1alpha1
rbac.authorization.k8s.io/v1beta1
storage.k8s.io/v1beta1
v1

@foxish
Copy link
Contributor Author

foxish commented Feb 1, 2017

I was just using kubectl.sh to run the newly built client from master.
@ymqytw What version of kubectl are you running?

@mengqiy
Copy link
Member

mengqiy commented Feb 1, 2017

@foxish kubectl is built on HEAD

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.1.162+cb758738f98d41-dirty", GitCommit:"cb758738f98d414674c9d06fb9ebf0e87bd10265", GitTreeState:"dirty", BuildDate:"2017-02-01T21:21:04Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.0.3926+d98615db9a5ea7", GitCommit:"d98615db9a5ea7d00ddf947767669f5888eba5e7", GitTreeState:"clean", BuildDate:"2017-01-26T02:14:25Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}

@foxish
Copy link
Contributor Author

foxish commented Feb 1, 2017

My server version is 1.5.2. I'm having issues with new kubectl and 1.5.x server version still. Checking against a server built from HEAD now.

@mengqiy
Copy link
Member

mengqiy commented Feb 2, 2017

@foxish Does it work?

@foxish
Copy link
Contributor Author

foxish commented Feb 6, 2017

Yes, it works with server and client built from HEAD. But the problem persists with a 1.5.2 server and client built from HEAD. The server says it doesn't know about StatefulSets, PDBs etc (no policy/ or apps/ group). Is that kind of server-client version skew something we officially support?

@foxish foxish changed the title kubectl built from head does not recognize all api versions kubectl built from head does not recognize all api versions with older server version Feb 6, 2017
@adohe-zz
Copy link

Is that kind of server-client version skew something we officially support?

This should be some server-client version skew, and basically we should support old server version.

@adohe-zz
Copy link

will take a look asap.

@calebamiles calebamiles modified the milestones: v1.6, 1.6 Feb 13, 2017
@foxish
Copy link
Contributor Author

foxish commented Feb 16, 2017

Thanks @adohe

@chrislovecnm
Copy link
Contributor

@adohe / @foxish so I am thinking this is a bug in 1.5.x currently. This does not have a priority on it. Are we planning on getting this fixed by 1.6?

@adohe-zz
Copy link

adohe-zz commented Mar 2, 2017

@chrislovecnm if I can raise a PR by this weekend, I will try to get it into 1.6(already code freeze :()

@liggitt
Copy link
Member

liggitt commented Mar 2, 2017

it looks like the user agent set by kubectl build from head is wrong:

make

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"7+", GitVersion:"v1.7.0-alpha.0.674+fa0387c9fea7cf-dirty", GitCommit:"fa0387c9fea7cf4b3e3032bb384d8b5f99580154", GitTreeState:"dirty", BuildDate:"2017-03-02T18:20:59Z", GoVersion:"go1.7", Compiler:"gc", Platform:"darwin/amd64"}

$ kubectl api-versions --v=8
I0302 13:26:00.012741   53505 loader.go:354] Config loaded from file .kubeconfig
I0302 13:26:00.013091   53505 round_trippers.go:395] GET http://localhost:8080/api
I0302 13:26:00.013100   53505 round_trippers.go:402] Request Headers:
I0302 13:26:00.013104   53505 round_trippers.go:405]     Accept: application/json, */*
I0302 13:26:00.013107   53505 round_trippers.go:405]     User-Agent: kubectl/v0.0.0 (darwin/amd64) kubernetes/$Format
I0302 13:26:00.014959   53505 round_trippers.go:420] Response Status: 200 OK in 1 milliseconds
I0302 13:26:00.014971   53505 round_trippers.go:423] Response Headers:
I0302 13:26:00.014983   53505 round_trippers.go:426]     Content-Length: 137
I0302 13:26:00.014986   53505 round_trippers.go:426]     Content-Type: application/json
I0302 13:26:00.014989   53505 round_trippers.go:426]     Date: Thu, 02 Mar 2017 18:26:00 GMT
I0302 13:26:00.015022   53505 request.go:991] Response Body: {"kind":"APIVersions","versions":["v1"],"serverAddressByClientCIDRs":[{"clientCIDR":"0.0.0.0/0","serverAddress":"10.192.208.225:6443"}]}
I0302 13:26:00.015162   53505 round_trippers.go:395] GET http://localhost:8080/apis
I0302 13:26:00.015169   53505 round_trippers.go:402] Request Headers:
I0302 13:26:00.015172   53505 round_trippers.go:405]     Accept: application/json, */*
I0302 13:26:00.015176   53505 round_trippers.go:405]     User-Agent: kubectl/v0.0.0 (darwin/amd64) kubernetes/$Format

that incorrect user agent triggers a workaround in the 1.5.x apiserver that omits the apps API group when requested by an "old" kubectl (#35840)

@liggitt
Copy link
Member

liggitt commented Mar 2, 2017

not sure if that same issue exists with an official release build of kubectl or not

@adohe-zz
Copy link

adohe-zz commented Mar 5, 2017

The root cause is when use kubectl version, the client version derived from pkg/version, but the inner client version derived from client-go. @deads2k ptal.

@liggitt
Copy link
Member

liggitt commented Mar 5, 2017

@caesarxuchao PTAL

@deads2k
Copy link
Contributor

deads2k commented Mar 6, 2017

The root cause is when use kubectl version, the client version derived from pkg/version, but the inner client version derived from client-go. @deads2k ptal.

I think the root cause is probably a bug in the workaround for the API server. It's detection of "old" should be tightly contained.

@caesarxuchao
Copy link
Member

@caesarxuchao
Copy link
Member

And the version sent by kubectl built from head is:

User-Agent: kubectl/v0.0.0

v0.0.0 is considered older than v1.5.0. The workaround in 1.5 API server didn't consider this case.

We can send a bug fix to the 1.5 branch to specially treat v0.0.0.

@caesarxuchao
Copy link
Member

User-agent in kubectl built from v1.6.0-alpha.2 is kubectl/v1.6.0, so it's correct in the releases.

@bgrant0607 bgrant0607 added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. labels Mar 9, 2017
@adohe-zz
Copy link

I think the root cause is probably a bug in the workaround for the API server. It's detection of "old" should be tightly contained.

Thanks point out @deads2k

k8s-github-robot pushed a commit that referenced this issue Mar 13, 2017
Automatic merge from submit-queue

Fix v0.0.0 in kubectl built from master

Fixes #40813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

No branches or pull requests

9 participants