<p>I am really confused about Kubernetes default Network Policy. By accessing the official <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/" rel="nofollow noreferrer">document</a>, I can read that:</p>
<ul>
<li>By default, a pod is non-isolated for egress; all outbound connections are allowed</li>
<li>By default, a pod is non-isolated for ingress; all inbound connections are allowed</li>
</ul>
<p>Hence, <code>my understanding is all connections are allowed</code>. However, obviously that is not true. If, for example, creating a namespace and two pods inside it, it is not possible to communicate among each other unless you specify both <code>Ingress</code> and <code>Egress</code> Network policies.
<em><strong>What do I miss?</strong></em></p>

Unknown developer
<p>You check the link <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/#default-policies" rel="nofollow noreferrer">Default policies</a></p>
<p>By default, if no policies exist in a namespace, then all ingress and egress traffic is allowed to and from pods in that namespace.</p>
<p>You can create two pods with nginx image in a namespace.</p>
<pre><code>kubectl run nginx1 --image=nginx --port=80
</code></pre>
<pre><code>kubectl run nginx2 --image=nginx --port=80
</code></pre>
<p>check the pod ips</p>
<pre><code>kubectl get pods -o wide
</code></pre>
<p>Run the curl command try to access</p>
<p>nginx1 to nginx2</p>
<pre><code>kubectl exec -it nginx1 -- curl -I nginx2ip
</code></pre>
<p>Output:</p>
<pre><code>HTTP/1.1 200 OK
Server: nginx/1.21.6
Date: Wed, 22 Jun 2022 13:42:57 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Tue, 25 Jan 2022 15:03:52 GMT
Connection: keep-alive
ETag: &quot;61f01158-267&quot;
Accept-Ranges: bytes
</code></pre>
<p>nginx2 to nginx1</p>
<pre><code>kubectl exec -it nginx2 -- curl -I nginx1ip
</code></pre>
<p>Output:</p>
<pre><code>HTTP/1.1 200 OK
Server: nginx/1.21.6
Date: Wed, 22 Jun 2022 13:45:26 GMT
Content-Type: text/html
Content-Length: 615
Last-Modified: Tue, 25 Jan 2022 15:03:52 GMT
Connection: keep-alive
ETag: &quot;61f01158-267&quot;
Accept-Ranges: bytes
</code></pre>
<p>Above both requests will get success responses</p>
