title: How to configure kubernetes to allow for long running interactive sessions?
body: <p>Having a problem here running <code>v1.5.1</code> using the <code>kubectl run/exec -i --tty</code> feature.</p>
  
  <p>Connections do not get interrupted when data is being sent. So when I launch an interactive container session, with a script that outputs something every now and then, it seems to work.</p>
  
  <p>Based on that, I created a <strong>nasty workaround</strong> to keep my container sessions going, without my interaction. It is really annoying that these sessions terminate prematurely. They leave garbage behind, that needs to cleaned up in case you are attaching to a running production container.</p>
  
  <p>The workaround (print a space-character <code></code> to STDERR every 59 seconds as a background process):</p>
  
  <pre><code># within your container session
  $ while :; do sleep 59; echo -n ' ' &gt;&amp;2; done &amp;
  </code></pre>
  
  <p>See the following output, when I do not launch such a script.
  <strong>It demonstrates that an interactive session terminates prematurely within ~ 2 minutes.</strong></p>
  
  <p>This is really annoying if you are leveraging this functionality to debug running applications and container installations.</p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p><em>Re-post from this <a href="https://github.com/kubernetes/kubernetes/issues/15702#issuecomment-271551811" rel="nofollow noreferrer">Github Issue</a>.</em></p>