Hi,
I am trying to restrict traffic to a port which is a node port through a kubernetes network policy. I have written a network policy which restricts ingress traffic from a namespace and an ipBlock. My network policy is as follows:
apiVersion: extensions/v1beta1
kind: NetworkPolicy
metadata:
name: <name_of_the_policy>
namespace: <namespace_name>
spec:
podSelector:
matchLabels:
name: <name_of_the_pod>
namespace: <namespace_of_the_pod>
ingress:
- ports:
- port: <portNo>
from:
- namespaceSelector:
matchLabels:
name: <namespace_name>
- ipBlock:
cidr: <ipaddress_range>
Even after applying the policy, that port is still accessible to from outside. Is there anything I am missing or doing wrong? Any suggestions will be helpful!
Thanks,
Deepthi