<p>I am using kubernetes-dashboard to view all pods, check status, login, pass commands, etc. It works good, but there is a lot of connectivity issues related to it. I am currently running it on port-8443, and forwarding the connection from 443 to 8443 via Nginx's proxy pass. But I keep getting bad gateway, and connection keeps dropping. It's not an nginx issue, since I have kubernetes  error. I am using Letsencrypt certificate in nginx, What am I doing wrong?</p>
<p>Error log :</p>
<pre><code>E0831 05:31:45.839693   11324 portforward.go:385] error copying from local connection to remote stream: read tcp4 127.0.0.1:8443-&gt;127.0.0.1:33380: read: connection reset by peer
E0831 05:33:22.971448   11324 portforward.go:340] error creating error stream for port 8443 -&gt; 8443: Timeout occured
</code></pre>
<p>Theses are the 2 errors I constantly get. I am running this command as a nohup process :</p>
<pre><code>nohup kubectl port-forward -n kubernetes-dashboard service/kubernetes-dashboard 8443:443 --address 0.0.0.0 &amp;
</code></pre>
<p>And finally my nginx config :</p>
<p>default :</p>
<pre><code>  location / {
             proxy_intercept_errors off;
             proxy_pass https://localhost:8443/;
        }
</code></pre>
<p>Thank you. :-)</p>

We are Borg
<p>Unfortunately this is an on-going issue with Kubernetes' port forwarding. You may find it not particularly reliable when used for long-running connections. If possible, try to setup a direct connection instead. A more extended discussion regarding this can be found <a href="https://github.com/kubernetes/kubernetes/issues/78446" rel="nofollow noreferrer">here</a> and <a href="https://github.com/kubernetes/kubernetes/issues/74551" rel="nofollow noreferrer">here</a>.</p>
