<p>My scenary is like the image below:</p>
<p><a href="https://i.stack.imgur.com/3txty.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3txty.png" alt="enter image description here" /></a></p>
<p>After a couple of days trying to find a way to block connections among pods based on a rule i found the  <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/" rel="nofollow noreferrer">Network Policy</a>. But it's not working for me neither at Google Cloud Platform or Local Kubernetes!</p>
<p>My scenary is quite simple, i need a way to block connections among pods based in a rule (e.g. namespace, workload label and so on). At the first glance i tought the will work for me, but i don't know why it's not working at the Google Cloud, even when i create a cluster from the scratch with the option &quot;Network policy&quot; enable.</p>

<p>Network policy will allow you to do exactly what you described on picture. You can allow or block based on labels or namespaces.</p>
<p>It's difficult to help you when you don't explain what you exactly did and what is not working. Update your question with actual network policy YAML you created and ideally also send <code>kubectl get pod --show-labels</code> from the namespace with the pods.</p>
<p>What do you mean by 'local kubernetes' is also unclear but it depends largely on network CNI you're using as it must support network policies. For example Calico or Cilium support it. Minikube in it's default setting don't so you should follow i.e. this guide: <a href="https://medium.com/@atsvetkov906090/enable-network-policy-on-minikube-f7e250f09a14" rel="nofollow noreferrer">https://medium.com/@atsvetkov906090/enable-network-policy-on-minikube-f7e250f09a14</a></p>
