<p>How can I make <code>Skaffold</code> forward privileged/protected/special ports which have numbers below <code>1024</code>? In my <code>skaffold.yaml</code> I added:</p>
<pre class="lang-yaml prettyprint-override"><code>portForward:
- resourceType: service
  resourceName: foo
  port: 80
  localPort: 80
</code></pre>
<p>It works fine for all unprotected ports, but in case of port <code>80</code>, <code>Skaffold</code> automatically picks another unprotected port instead of <code>80</code>.</p>
<p>According to the documentation <code>Skaffold</code> runs <code>kubectl port-forward</code> on each of user-defined ports, so I granted the <code>kubectl</code> binary the capability to open privileged ports with this command <code>sudo setcap CAP_NET_BIND_SERVICE=+eip /path/to/kubectl</code>.</p>
<p>Everything works fine when directly running <code>kubectl port-forward services/foo 80:80</code>, but when I run <code>skaffold dev --port-forward</code> it still picks another unprotected port.</p>
<p>I have been using <code>Skaffold v1.28.1</code> with <code>Minikube v1.22.0</code> on <code>Ubuntu 20.04</code>.</p>

<p>This should work.  We changed Skaffold's behaviour to prevent it from allocating system ports (≤ 1024), but user-defined port-forwards with explicit <code>localPort</code>s will still be honoured.</p>
<p>You didn't say what ports you were seeing being allocated, but I suspect they were ports 4503–4533, in which you're hitting a bug (<a href="https://github.com/GoogleContainerTools/skaffold/issues/6312" rel="nofollow noreferrer">#6312</a>).  This bug is now fixed and will be in the next release.  You can also use the &quot;bleeding-edge&quot; build which is built from HEAD: the <a href="https://skaffold.dev/docs/install/" rel="nofollow noreferrer">installation instructions</a> have details for where to fetch these pre-built binaries.</p>
