Semoon Park:
Hi, have a question about Network Policy
• for selecting by namespaces, do I have to use namespaceSelector
?
• If I have to use namespaceSelector
then what will be the yaml? it could be like below?
....
namespaceSelector:
matchLabels:
name=<NAMESPACE_NAME>
Abhishek Gupta:
There should not be equal symbol in the label selector. Check out the example for namespace selector here https://kubernetes.io/docs/concepts/services-networking/network-policies/#networkpolicy-resource .
Semoon Park:
I saw that, but if I have to do, will it be possible to select by it’s name?
Or add label to the namespace and then use that label?
Abhishek Gupta:
You need to add label to the namespace
Abhishek Gupta:
Go over this below link to practice network policies. It covers some tricky scenarios. https://github.com/ahmetb/kubernetes-network-policy-recipes
Semoon Park:
Thanks a lot