Kubectl exec ..-/ bin / bash无法连接

AHe*_*rth 3 kubernetes google-kubernetes-engine

最近,我无法连接到kubernetes集群上的bash。我不知道为什么。其他人有没有经历过?

发生了什么:我再也无法在运行的Pod中连接到/ bin / bash。尝试执行命令时,它只是挂起。我已验证已安装bash(/bin/bash --version)。我已经在本地和Google Cloud Console中尝试过

您预期会发生什么:我的本地终端成功连接到pods bash终端

如何(尽可能最小且精确地)再现它:我仅在集群上对其进行了测试,但是我正在运行的命令是:

kubectl exec -i POD_ID --namespace=NAMESPACE -c CONTAINER -- /bin/bash

我还用DEBUG = 1运行了它,结果如下:

DEBUG=1 kubectl exec -i POD_ID --namespace=NAMESPACE -c CONTAINER -- 
/bin/bash
I0412 10:52:14.560443    2675 logs.go:41] (0xc4200aed10) 
(0xc420242140) Create stream
I0412 10:52:14.560486    2675 logs.go:41] (0xc4200aed10) 
(0xc420242140) Stream added, broadcasting: 1
I0412 10:52:14.611561    2675 logs.go:41] (0xc4200aed10) Reply frame 
received for 1
I0412 10:52:14.611658    2675 logs.go:41] (0xc4200aed10) 
(0xc4203e26e0) Create stream
I0412 10:52:14.611692    2675 logs.go:41] (0xc4200aed10) 
(0xc4203e26e0) Stream added, broadcasting: 3
I0412 10:52:14.656684    2675 logs.go:41] (0xc4200aed10) Reply frame 
received for 3
I0412 10:52:14.656725    2675 logs.go:41] (0xc4200aed10) 
(0xc4202425a0) Create stream
I0412 10:52:14.656737    2675 logs.go:41] (0xc4200aed10) 
(0xc4202425a0) Stream added, broadcasting: 5
I0412 10:52:14.702100    2675 logs.go:41] (0xc4200aed10) Reply frame 
received for 5
I0412 10:52:14.702140    2675 logs.go:41] (0xc4200aed10) 
(0xc420659680) Create stream
I0412 10:52:14.702151    2675 logs.go:41] (0xc4200aed10) 
(0xc420659680) Stream added, broadcasting: 7
I0412 10:52:14.746707    2675 logs.go:41] (0xc4200aed10) Reply frame 
received for 7
Run Code Online (Sandbox Code Playgroud)

我们还有什么需要知道的吗?

环境:-Kubernetes版本

Client Version: version.Info{Major:"1", Minor:"8", 
GitVersion:"v1.8.6", 
GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", 
GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", 
GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"9+", 
GitVersion:"v1.9.6-gke.0", 
GitCommit:"cb151369f60073317da686a6ce7de36abe2bda8d", 
GitTreeState:"clean", BuildDate:"2018-03-21T19:01:20Z", 
GoVersion:"go1.9.3b4", Compiler:"gc", Platform:"linux/amd64"}
Run Code Online (Sandbox Code Playgroud)
  • 云提供商或硬件配置: Google Cloud
  • 操作系统(例如,来自/etc/os-release):

    PRETTY_NAME =“ Debian GNU / Linux 9(stretch)” NAME =“ Debian GNU / Linux” VERSION_ID =“ 9” VERSION =“ 9(stretch)” ID = debian HOME_URL =“ https://www.debian.org/” SUPPORT_URL =“ https://www.debian.org/support” BUG_REPORT_URL =“ https://bugs.debian.org/”

  • 内核(例如uname -a): Linux bounce-deployment-f95687cbc-mfgtg 4.4.111+ #1 SMP Thu Feb 1 22:06:37 PST 2018 x86_64 GNU/Linux

  • 安装工具:
  • 其他:

ten*_*nix 5

你必须传递-tkubectl exec命令,就像docker exec -i -t <container_name> bash

从帮助命令:

-t,--tty = false:Stdin是TTY