Hi Team, need small help with mock exam 3, question -5. If i have pod selector as {} in ingress section, its showing failed in review, can you please confirm whats wrong if i define my yaml like attached. Thank You.
You need to make the network policy with name ingress-to-nptest , Port 53 is used to be able to reach the service using a service name instead of IP. Check the following:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: ingress-to-nptest
namespace: default
spec:
podSelector:
matchLabels:
run: np-test-1
policyTypes:
Ingress
- from:
- podSelector: {}
- ports:
- protocol: TCP
port: 80
- ports:
- protocol: TCP
port: 53
- protocol: UDP
port: 53