Create a new NetworkPolicy named allow-port-from-namespace in the existing namespace fubar.
Ensure that the new NetworkPolicy allows Pods in namespace internal to connect to port 9000 of Pods in namespace fubar.
Further ensure that the new NetworkPolicy:
✑ does not allow access to Pods, which don’t listen on port 9000
✑ does not allow access from Pods, which are not in namespace internal
I used the below yml file for np creation and three pods in playlabs for testing purpose
1.nginx in default ns
2.nginx in ns fubar listening on port 9000
3.nginx in ns internal
Thanks even if i change the port the pods on ns internal not connecting pods on ns fubar on port 9000
I created three pods with image nginx in the 1. default ns / 2. ns fubar exposed to 9000 / 3. ns internal
while runnning the command below its showing err
k exec nginx -n internal – curl < ip of the pod in ns fubar>