Yoshiaki K:
Hello. I have a question about NetworkPolicy.
Is there a good way to list the Pods using a specific NetworkPolicy, or the opposite, list the NetworkPolicy attached to a specific Pod? Whichever would help.
As far as I know, I have to examine the NetworkPolicy’s selectors and check if they matches by eyes. Is there a solid way to programmatically confirm the connection between pod and netpol?
Sangeetha Radhakrishnan:
To know the list of pods using NetworkPolicy you can use kubectl get netpol command which will list all network polices and the pod selector. If you are looking more details like what policy configured, from/to which pod selector etc., you can do jsonpath query or custom columns. For more details about this check the below links:
https://kubernetes.io/docs/reference/kubectl/jsonpath/
https://kubernetes.io/docs/reference/kubectl/overview/#custom-columns