<p>I am using minikube on my local machine. Getting this error while using kubernetes port forwarding. Can anyone help?</p>

<pre><code>mjafary$ kubectl port-forward  sa-frontend 88:80

Unable to listen on port 88: All listeners failed to create with the following errors: 
Unable to create listener: Error listen tcp4 127.0.0.1:88: bind: permission denied, Unable to create listener: Error listen tcp6 [::1]:88: bind: permission denied
error: Unable to listen on any of the requested ports: [{88 80}] 
</code></pre>

Jaf
<p><code>kubectl</code> fails to open the port 88 because it is a privileged port. All ports &lt;1024 require special permissions.</p>
<p>There are many ways to solve your problem.</p>
<ul>
<li>You can stick to ports &gt;= 1024, and use for example the port 8888 instead of 88: <code>kubectl port-forward sa-frontend 8888:80</code></li>
<li>You could use <code>kubectl</code> as root: <code>sudo kubectl port-forward sa-frontend 88:80</code> (not recommended, kubectl would then look for its config as root)</li>
<li>You could grant the <code>kubectl</code> binary the capability to open privileged ports. <a href="https://superuser.com/a/892391/48678">This answer</a> explains in depth how to do this.</li>
</ul>
<p>If you want to go for the 3rd option, here is a short way of doing it:</p>
<pre><code>sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/kubectl
</code></pre>
<p>This will let <code>kubectl</code> open any port while still running with the privileges of a regular user. You can check if this worked by using</p>
<pre><code>sudo getcap /usr/bin/kubectl 
/usr/bin/kubectl = cap_net_bind_service+eip
</code></pre>
<p>Be aware that this grants the permission to whoever uses the binary. If you want finer grained permissions, use authbind.</p>
<p>Note: as <a href="https://stackoverflow.com/users/6463291/ng-sek-long">ng-sek-long</a> <a href="https://stackoverflow.com/questions/53775328/kubernetes-port-forwarding-error-listen-tcp4-127-0-0-188-bind-permission-de/55023272?noredirect=1#comment122743640_55023272">commented</a>, <code>kubectl</code> is not necessarily installed as <code>/usr/bin/kubectl</code>. You should replace it with the path to the kubectl binary on your machine.</p>
