ahmetb / kubernetes-network-policy-recipes

Example recipes for Kubernetes Network Policies that you can just copy paste

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Its also block the traffic from the same namespace pods

girishsuri15 opened this issue · comments

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: isolate-namespace
namespace: girish
spec:
podSelector:
matchLabels: {}
ingress:

  • from:
    • podSelector: {}
      #####################################################################

NAME READY STATUS RESTARTS AGE
pod/curl123 1/1 Running 0 6m25s
pod/nginx-deployment-58dff6b464-qqk2w 1/1 Running 0 9m36s
pod/nginx-deployment-58dff6b464-xlk42 1/1 Running 0 9m36s

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ng ClusterIP 10.100.66.78 8080/TCP 6m39s

$kubectl exec curl123 curl http://10.100.66.78:8080 -n girish
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:14 --:--:-- 0

I can’t even read this.