<p>I have created the below 'pod` in default namespace</p>
<pre><code> kubectl run myhttpd --image=&quot;docker.io/library/nginx:latest&quot; --restart=Never -l app=httpd-server --port 80
</code></pre>
<p>I was creating another Pod on a different <code>namespace</code> to check the connectivity on <code>port 80</code> on <code>default namespace</code> with the below <code>command</code></p>
<pre><code>kubectl run cli-httpd --rm -it --image=busybox --restart=Never -l app=myhttpd -- /bin/sh
If you don't see a command prompt, try pressing enter.
/ # wget --spider --timeout=1 100.64.9.198  (IP of application in default namespace)
</code></pre>
<p>In order to allow the connectivity between both the namespace , I have created the below <code>Pod network policy</code></p>
<pre><code>  apiVersion: networking.k8s.io/v1
  kind: NetworkPolicy
  metadata:

  name: allow-port-ingress-80
  namespace: default
  spec:
    podSelector:
       matchLabels:
       app: myhttpd
    policyTypes:
    - Ingress
    ingress:
    - from:
      - ipBlock:
         cidr: 10.64.8.0/22
     ports:
       - protocol: TCP
         port: 80
</code></pre>
<p><code>10.64.8.0/22</code> is the Pods network range.</p>
<p>But the connectivity is timing out. Please suggest to allow this connectivty</p>

Zama Ques
<p>In NetworkPolicy, the ipBlock is usually meant to allow communications from outside your SDN.</p>
<p>What you want to do is to filter based on pod labels.</p>
<p>Having started your test pod, check for its labels</p>
<pre><code>kubectl get pods --show-labels
</code></pre>
<p>Pick one that identify your Pod, while not matching anything else, then fix your NetworkPolicy. Should look something like:</p>
<pre><code>spec:
  ingress:
  - from:
    - podSelector: # assuming client pod belongs to same namespace as application
        matchLabels:
          app: my-test # netpol allows connections from any pod with label app=my-test
    ports:
    - port: 80 # netpol allows connections to port 80 only
      protocol: TCP
  podSelector:
    matchLabels:
      app: myhttpd  # netpol applies to any pod with label app=myhttpd
  policyTypes:
  - Ingress
</code></pre>
<p>While ... I'm not certain what the NetworkPolicy specification says regarding ipBlocks (can they refer to SDN ranges?) ... depending on your SDN, I guess your configuration &quot;should&quot; work, in some cases, maybe. Maybe your issue is only related to label selectors?</p>
<p>Note, allowing connections from everywhere, I would use:</p>
<pre><code>spec:
  ingress:
  - {}
....
</code></pre>
