<p>I'm trying to restrict to my openvpn to allow accessing internal infrastructure and limit it only by 'develop' namespace, so I started with simple policy that denies all egress traffic and see no effect or any feedback from cluster that it was applied, I've read all docs both official and not and didn't find a solution, here is my policy:</p>

<pre><code>kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  name: policy-openvpn
  namespace: default
spec:
  podSelector:
    matchLabels:
      app: openvpn
  policyTypes:
  - Egress
  egress: []
</code></pre>

<p>I've applied network policy above with <code>kubectl apply -f policy.yaml</code> command, but I don't see any effect of this policy, I'm still able to connect to anything from my openvpn pod, how to debug this and see what's wrong with my policy? </p>

<p>It seems like a black-box for me and what can do only is try-error method, which seems not how it should work. </p>

<p>How can I validate that it finds pods and applies policy to them?</p>

<p>I'm using latest kubernetes cluster provided by GKE</p>

<p>I noticed that I didn't check 'use networkpolicy' in google cloud settings and after I checked my vpn just stopped worked, but I don't know how to check it, or why vpn just allows me to connect and blocks all network requests, very strange, is there a way to debug is instead of randomly changing stuff?</p>

<p>GKE uses calico for implementing network policy. You need to enable network network policy for master and nodes before applying network policy. You can verify whether calico is enabled by looking for calico pods in kube-system namespace.</p>

<pre><code>kubectl get pods --namespace=kube-system
</code></pre>

<p>For verifying the network policies you can see the following commands. </p>

<pre><code>kubectl get networkpolicy
kubectl describe networkpolicy &lt;networkpolicy-name&gt;
</code></pre>
