v1.5.1
使用该kubectl run/exec -i --tty
功能运行时出现问题。
发送数据时连接不会中断。因此,当我启动一个交互式容器会话时,使用一个不时输出某些内容的脚本,它似乎可以工作。
基于此,我创建了一个令人讨厌的解决方法来让我的容器会话继续进行,而无需我的交互。这些会话过早终止真的很烦人。它们会留下垃圾,如果您连接到正在运行的生产容器,则需要清理这些垃圾。
解决方法(作为后台进程每 59 秒打印一个空格字符到 STDERR):
# within your container session
$ while :; do sleep 59; echo -n ' ' >&2; done &
当我不启动这样的脚本时,请参阅以下输出。 它表明交互式会话在约 2 分钟内过早终止。
如果您使用此功能来调试正在运行的应用程序和容器安装,这真的很烦人。
$ time kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
Waiting for pod default/busybox to be running, status is Pending, pod ready: false
If you don't see a command prompt, try pressing enter.
/ # Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
Waiting for pod default/busybox to terminate, status is Running
error: timed out waiting for the condition
real 2m4.657s
从此Github 问题重新发布。