4

If I oc rsh <pod>, the shell will timeout in a matter of seconds unless the shell is actively printing output.

How can I increase or eliminate the timeout of oc rsh ?

2 Answers 2

0

This sounds like less of an issue with oc rsh, and more of an issue with how you're running your pods. If your pod exits, kubernetes will kill it and start a new one (that's just what it does). So, it sounds like you're running a short-lived script, and want to oc rsh to it for (I would assume) debugging purposes.

If that's the case, you should try oc debug <pod>, this will essentially give you the shell access you want, without the requirement for the pod to stay long running.

The other alternative could be something like oc run, which will basically just use the image you want, but you can override the commands. Something like

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

(The --restart=Never basically ensures this is just a pod, and when you exit, it dies. If you omit it, it'll use a DeploymentConfig and when you exit, it'll just restart itself)

0

In OCP4, TCP Streaming connections like oc rsh get closed after 60 seconds. You can increase the timeout client and timeout server in /etc/haproxy/haproxy.cfg and restart the haproxy service.

In OCP3.x < 3.10 try passing a kubeletArgument for the streaming-connection-idle-timeout parameter to /etc/origin/node/node-config.yaml like this:

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

In OCP 3.x >= 3.10 you'd need to add that kubeletArgument in the node configmaps, e.g.: oc -n openshift-node edit cm node-config-compute

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.