<p>I am running a k8s cluster on bare-metal RHEL7.  I am trying to run the kubectl port-forward command and am getting a error. </p>

<pre><code>kubectl port-forward -p somepod 10000:8080
I0128 15:33:33.802226   70558 portforward.go:225] Forwarding from 127.0.0.1:10000 -&gt; 8080                                                        
E0128 15:33:33.802334   70558 portforward.go:214] Unable to create listener: Error listen tcp6 [::1]:10000: bind: cannot assign requested address
</code></pre>

<p>Any ideas why this could be happening?</p>

<p>If you run kubectl port-forward multiple times, and you have ipv6 enabled on your machine you will run on this quite often.</p>

<p>There are two solutions:</p>

<ol>
<li>Run <strong>netstat -nlp | grep 10000</strong> in order to know the PID of the process using that port. Then you can kill it with <strong>kill -9 PID_OF_PROCESS</strong></li>
<li><p>Permanent solution: disable ipv6</p>

<p>echo "<br>
net.ipv6.conf.all.disable_ipv6=1<br>
net.ipv6.conf.default.disable_ipv6=1 <br>
net.ipv6.conf.lo.disable_ipv6=1 <br>
" | sudo tee -a /etc/sysctl.conf reboot"</p></li>
</ol>
