<p>Here is a section of my network policy:</p>
<pre><code>egress:
   -to:
     - ipBlock: 
         cidr: 10.0.0.0/32
     - ipBlock:
         cidr: 10.0.0.1/32
    ports:
     - protocol: TCP
       port: 5978
</code></pre>
<p>I have a doubt whether these IPs will be allowed to connect to the same port.</p>
<p>Basically, if we want to have a different port for a different IP, what can we do?</p>

<p>I assume the snippet you shared is a portion of a NetworkPolicy.</p>
<p>If so, you can have multiple entries in the <code>egress</code> field, like this for example:</p>
<pre><code>egress:
  - to:
    - ipBlock: 
        cidr: 10.0.0.1/32
    ports:
    - protocol: TCP
      port: 5978
  - to:
    - ipBlock: 
        cidr: 10.0.0.2/32
    ports:
    - protocol: TCP
      port: 1234
</code></pre>
