【问题标题】:Openshift oc rsh Increase TimeoutOpenshift oc rsh 增加超时
【发布时间】:2019-04-20 21:19:51
【问题描述】:

如果我oc rsh <pod>,shell 将在几秒钟内超时,除非 shell 正在主动打印输出。

如何增加或消除oc rsh 的超时时间?

【问题讨论】:

    标签: openshift openshift-client-tools


    【解决方案1】:

    这听起来不像是 oc rsh 的问题,而更像是您运行 pod 的问题。如果您的 pod 退出,kubernetes 将杀死它并启动一个新的(这就是它的作用)。因此,听起来您正在运行一个短暂的脚本,并且想要oc rsh 用于(我假设)调试目的。

    如果是这种情况,您应该尝试oc debug <pod>,这实际上会为您提供所需的 shell 访问权限,而无需让 pod 长时间运行。

    另一种选择可能是oc run,它基本上只使用您想要的图像,但您可以覆盖commands。类似的东西

    oc run -i -t busybox --image=busybox --restart=Never -- /bin/sh
    

    --restart=Never 基本上确保这只是一个 pod,当你退出时,它会死掉。如果你省略它,它将使用 DeploymentConfig,当你退出时,它会自行重启)

    【讨论】:

      【解决方案2】:

      在 OCP4 中,像 oc rsh 这样的 TCP 流连接会在 60 秒后关闭。您可以在/etc/haproxy/haproxy.cfg中增加timeout clienttimeout server并重启​​haproxy服务。

      在 OCP3.x streaming-connection-idle-timeout 参数的 kubeletArgument 传递给 /etc/origin/node/node-config.yaml,如下所示:

      kubeletArguments:
        streaming-connection-idle-timeout:
        - "10m"
      

      在 OCP 3.x >= 3.10 中,您需要在节点配置映射中添加 kubeletArgument,例如:oc -n openshift-node edit cm node-config-compute

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-09-30
        • 1970-01-01
        • 2019-04-27
        • 1970-01-01
        • 2019-04-08
        • 2015-04-28
        • 2017-09-16
        • 2010-10-31
        相关资源
        最近更新 更多