<p>I'm trying to forward port 8080 for my nginx ingress controller for Kubernetes. I'm running the command:</p>
<pre><code>kubectl -n nginx-ingress port-forward nginx-ingress-768dfsssd5bf-v23ja 8080:8080 --request-timeout 0
Forwarding from 127.0.0.1:8080 -&gt; 8080
Forwarding from [::1]:8080 -&gt; 8080
</code></pre>
<p>It just hangs on <code>::1</code> forever. Is there a log somewhere I can view to see why its hanging?</p>

<p>Well, it's expected  behaviour - <code>kubectl port-forward</code> is not getting <a href="https://stackoverflow.com/questions/48863164/kubernetes-prompt-freezes-at-port-forward-command/48866118#48866118">daemonized by default</a>. From the <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/#forward-a-local-port-to-a-port-on-the-pod" rel="nofollow noreferrer">official Kubernetes documentation</a>:</p>
<blockquote>
<p><strong>Note:</strong>  <code>kubectl port-forward</code> does not return. To continue with the exercises, you will need to open another terminal.</p>
</blockquote>
<p>The all logs will be shown in <code>kubectl port-forward</code> command output:</p>
<pre><code>user@shell:~$ kubectl port-forward deployment/nginx-deployment 80:80
Forwarding from 127.0.0.1:80 -&gt; 80
</code></pre>
<p><a href="https://stackoverflow.com/questions/53799600/kubernetes-port-forwarding-connection-refused">Including errors</a>:</p>
<pre><code>Handling connection for 88
Handling connection for 88
E1214 01:25:48.704335   51463 portforward.go:331] an error occurred forwarding 88 -&gt; 82: error forwarding port 82 to pod a017a46573bbc065902b600f0767d3b366c5dcfe6782c3c31d2652b4c2b76941, uid : exit status 1: 2018/12/14 08:25:48 socat[19382] E connect(5, AF=2 127.0.0.1:82, 16): Connection refused
</code></pre>
<p>If you don't have any logs that means you didn't make an attempt to connect or you specified a wrong address / port.</p>
<p>As earlier mentioned, you can open a new terminal window, you can also run <code>kubectl port-forward</code> <a href="https://linuxize.com/post/how-to-run-linux-commands-in-background/" rel="nofollow noreferrer">in the background</a> by adding <code>&amp;</code> at the end of the command:</p>
<pre><code>kubectl -n nginx-ingress port-forward nginx-ingress-768dfsssd5bf-v23ja 8080:8080 --request-timeout 0 &amp;
</code></pre>
<p>If you want to run <code>kubectl port-forward</code> in background and save all logs to the file you can use <a href="https://linux.101hacks.com/unix/nohup-command/" rel="nofollow noreferrer"><code>nohup</code> command</a> + <code>&amp;</code> at the end:</p>
<pre><code>nohup kubectl -n nginx-ingress port-forward nginx-ingress-768dfsssd5bf-v23ja 8080:8080 --request-timeout 0 &amp;
</code></pre>
