<p>While using kubectl port-forward function I was able to succeed in port forwarding a local port to a remote port. However it seems that after a few minutes idling the connection is dropped. Not sure why that is so.</p>

<p>Here is the command used to portforward:</p>

<pre><code>kubectl --namespace somenamespace port-forward somepodname 50051:50051
</code></pre>

<p>Error message:</p>

<pre><code>Forwarding from 127.0.0.1:50051 -&gt; 50051
Forwarding from [::1]:50051 -&gt; 50051
E1125 17:18:55.723715    9940 portforward.go:178] lost connection to pod
</code></pre>

<p>Was hoping to be able to keep the connection up</p>

<p>Setting kube's <code>streaming-connection-idle-timeout</code> to 0 should be a right solution, but if you don't want to change anything, you can use while-do construction</p>

<p>Format: <code>while true; do &lt;&lt;YOUR COMMAND HERE&gt;&gt;; done</code></p>

<p>So just inputing in CLI: <code>while true; do kubectl --namespace somenamespace port-forward somepodname 50051:50051; done</code> should keep kubectl reconnecting on connection lost</p>
