Guys I am still having doubts on NetworkPolicy essentially I have a following scnenario:
nginx frontend pod exposed with cluster ip on port 80
nginx backend pod exposed with cluster ip on port 80
Network Policy applied on backend pod with label run=backend
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: default
spec:
podSelector:
matchLabels:
run: backend
policyTypes:
- Ingress
- Egress
ingress:
- from:
- podSelector:
matchLabels:
run: frontend
ports:
- protocol: TCP
port: 80
egress:
- to:
- podSelector:
matchLabels:
run: frontend
ports:
- protocol: TCP
port: 80
I can curl from the frontend to the backend but I cannot curl from the backend to the frontend. Is something that can be done> I want just to be sure that frontend pod can talk with backend and backend pod can talk with frontend on port 80
Is something that can be done or the ingress rule is enough to accomplish both the direction?
Thanks in advance for your help.
``