【问题标题】:Timeout for Kubectl execKubectl 执行超时
【发布时间】:2018-07-11 16:48:23
【问题描述】:

如何设置 kubectl exec 命令的超时时间?

下面的命令不起作用

kubectl exec -it pod_name bash --requrest-timeout=0 -n test

【问题讨论】:

  • 有错误提示吗?
  • 我没有收到任何错误信息
  • 你的命令是正确的。我们唯一不知道的是您的Pod。你能描述一下吗?
  • 您需要什么样的信息来帮助我?它是由 stateful set 创建的 pod
  • 所以我执行以下命令:kubectl exec -it pod-0 bash --request-timeout=120s -n test 并进入容器外壳,root@*****:/opt/... 一段时间后,当我在外壳中什么都不做时,将我扔出外壳

标签: kubernetes timeout kubectl


【解决方案1】:

你有错字,试试:

kubectl exec -it pod_name bash --request-timeout=0 -n test

请参阅kubectl official documentation 了解请求超时

--request-timeout string           The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")

请注意,“0”已经是默认值了。

【讨论】:

  • 那么为什么一段时间后会抛出 pod 呢?
  • 默认情况下,它实际上并没有把你扔出吊舱。据我所理解;超时适用于 kubectl 命令本身。一旦执行,您将链接到 pods 进程
  • 所以这个命令设置了让我离开 pod 的时间段?
  • 没有;一旦连接到 pod,您的 kubectl 命令就不会超时了
  • @Webber 但是如果几个小时内没有任何操作,我仍然会离开 pod。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-14
  • 1970-01-01
  • 1970-01-01
  • 2014-12-25
  • 2010-09-16
  • 2012-11-18
相关资源
最近更新 更多