kubernetes: kubectl in-cluster mode conflicts with --request-timeout

/kind bug

What happened:

From a container running inside of a cluster:

# kubectl get po --request-timeout=11s
The connection to the server localhost:8080 was refused - did you specify the right host or port?

What you expected to happen:

# kubectl get po --request-timeout=11s
...long list of pods here...

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

  • Run a container with kubectl installed (I used an Ubuntu container)
  • kubectl get po <- this works
  • kubectl get po --request-timeout=11s <- this fails

Anything else we need to know?:

Looking through the logs -v=8, it looks like --request-timeout bypasses the part where it realizes that in-cluster mode is enabled.

Environment:

  • Kubernetes version (use kubectl version): I tested v.1.6.3 through v1.7.1
  • Cloud provider or hardware configuration**: Parallels hypervisor
  • OS (e.g. from /etc/os-release):
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
  • Kernel (e.g. uname -a): Linux ubuntu 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Install tools: kubeadm
  • Others:

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 3
  • Comments: 42 (18 by maintainers)

Commits related to this issue

Most upvoted comments

/assign

/reopen

This is still broken in 1.18.4

In a cluster, on a pod, I can issue kubectl get pods without trouble but if it includes --request-timeout it instantly fails:

# kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.4", GitCommit:"c96aede7b5205121079932896c4ad89bb93260af", GitTreeState:"clean", BuildDate:"2020-06-17T15:57:19Z", GoVersion:"go1.13.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.4", GitCommit:"c96aede7b5205121079932896c4ad89bb93260af", GitTreeState:"clean", BuildDate:"2020-06-17T15:57:19Z", GoVersion:"go1.13.6", Compiler:"gc", Platform:"linux/amd64"}
# kubectl get pods --request-timeout 30
The connection to the server localhost:8080 was refused - did you specify the right host or port?
# kubectl get pods
NAME                                                              READY   STATUS      RESTARTS   AGE
acr-transformer-6f497d647c-5rx7d                                  1/1     Running     0          18m
acr-transformer-6f497d647c-d9j2s                                  1/1     Running     0          18m
. . . .

Still an issue on kubectl 1.13.8

/reopen /remove-lifecycle rotten /lifecycle frozen

/reopen

This is a rather concerning issue as we ran into an issue where kubectl hung due to one of the masters not responding and thus we did not get some other operation to continue after the fact. We started to add --request-timeout but that does not work on nodes (as per above)

The current only work-around is to wrapper everything with yet another process to timeout the kubectl commands.