<p>I am using a deployment yaml file ex:nginx which i am using port 30080.
Now i wrote another deployment yaml file but i want to use port number 30080. </p>

<blockquote>
  <p>The Service "web" is invalid: spec.ports[0].nodePort: Invalid value: 30080: >provided port is already allocated</p>
</blockquote>

<p>How can i use the port number 30080 for my new deployment web.yaml file.
1)Deleted the nginx pod running.
2)Deleted nginx deployment running.</p>

<blockquote>
  <p>But how can i free up the port number 30080.</p>
</blockquote>

<p>i checked the port number:</p>

<blockquote>
  <blockquote>
    <blockquote>
      <p>sudo iptables-save | grep 30080</p>
    </blockquote>
  </blockquote>
</blockquote>

<pre><code>-A KUBE-EXTERNAL-SERVICES -p tcp -m comment --comment "default/nginx-service: has no endpoints" -m addrtype --dst-type LOCAL -m tcp --dport 30080 -j REJECT --reject-with icmp-
port-unreachable 
</code></pre>

<p>i deleted deployment and pod. But i forgot that service is running after deleting nginx service i am able to reuse the port number 30080 for other deployment.</p>
<p><a href="https://stackoverflow.com/questions/19071512/socket-error-errno-48-address-already-in-use">socket.error: [Errno 48] Address already in use</a></p>
<p>this question also helped me but it points to killing that process, here the process running is kube-proxy.</p>
<blockquote>
<p>sudo lsof -i:30080</p>
<p>COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF
NODE NAME kube-prox 3320 root    8u  IPv6  40388      0t0  TCP *:30080
(LISTEN)</p>
</blockquote>
<p>which i cant delete.It might create issue deleting kube-prox</p>
<p>Please let me know if this was the right approach or not.</p>
