kubernetes: Misleading kubectl error: the server doesn't have a resource type "po"

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened: When using kubectl 1.9.0-beta.1+, if you run kubectl get po, while the API server is unreachable, you get the following misleading error: the server doesn't have a resource type "po".

What you expected to happen: In versions 1.9.0-alpha.3 and lower, you get the proper error: The connection to the server 127.0.0.1:1 was refused.

How to reproduce it (as minimally and precisely as possible):

$ curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.9.0-beta.1/bin/linux/amd64/kubectl -o /tmp/kubectl \
&& chmod +x /tmp/kubectl \
&& /tmp/kubectl -s http://127.0.0.1:1 get po 
the server doesn't have a resource type "po"

If you try the same command with kubectl 1.9.0-alpha.3, you get the correct error message:

$ curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.9.0-alpha.3/bin/linux/amd64/kubectl -o /tmp/kubectl \
&& chmod +x /tmp/kubectl \
&& /tmp/kubectl -s http://127.0.0.1:1 get po 
The connection to the server 127.0.0.1:1 was refused - did you specify the right host or port?

You also get the same error message in kubectl 1.9.0-beta.1, if you use the full resource name instead of the abbreviation:

$ curl -sL https://storage.googleapis.com/kubernetes-release/release/v1.9.0-beta.1/bin/linux/amd64/kubectl -o /tmp/kubectl \
&& chmod +x /tmp/kubectl \
&& /tmp/kubectl -s http://127.0.0.1:1 get pod
The connection to the server 127.0.0.1:1 was refused - did you specify the right host or port?

Anything else we need to know?: This is a regression between 1.9.0-alpha.3 and 1.9.0-beta.1

/sig cli

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Hmm, @michidk are you sure? I’ve just tried it with v1.12.1 and can’t reproduce it anymore. Can you provide steps to reproduce the error?

$ ./kubectl version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:46:06Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server 127.0.0.1:8443 was refused - did you specify the right host or port?
$ ./kubectl get po 
The connection to the server 127.0.0.1:8443 was refused - did you specify the right host or port?

@luksa: Reopening this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

/reopen

This is still an issue in kubectl v1.11.2