<h1>this is my network policy:</h1>
<pre><code>apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: deny
  namespace: openstack
spec:
  podSelector:
    matchLabels: {} 
  policyTypes:
  - Egress
  - Ingress
</code></pre>
<p>I apply this policy and login into 1 pod and it still can connect to google.com.</p>
<p>-</p>
<pre><code>-2018-08-29 11:36:33--  http://google.com/
Resolving google.com (google.com)... 172.217.4.46, 2607:f8b0:4009:804::200e
Connecting to google.com (google.com)|172.217.4.46|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2018-08-29 11:36:33--  http://www.google.com/
Resolving www.google.com (www.google.com)... 172.217.4.36, 2607:f8b0:4009:804::2004
Connecting to www.google.com (www.google.com)|172.217.4.36|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html.85’

index.html.85                                      [ &lt;=&gt;                                                                                              ]  11.09K  --.-KB/s    in 0.001s  

2018-08-29 11:36:33 (7.77 MB/s) - ‘index.html.85’ saved [11355]
</code></pre>
<p>Does anyone can explain why the egress doesn't work? Thanks</p>

<p>Before using <code>NetworkPolicy</code>, you need to install a <code>CNI</code> plugin that supports network policies.</p>

<p>I use <code>Weave Net</code>, but you can use some other:</p>

<p><a href="https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/weave-network-policy/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/network-policy-provider/weave-network-policy/</a></p>

<p><a href="https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/</a></p>
