Is there a way to isolate one namespace from accessing other namespace but still be able to go outside the cluster I have 10 namespaces, I want that pods within this 1 namespace are not be able to talk to other namespaces but still be able to go outside the cluster to external resources while this is applied to only 1 namespace the other 9 namespaces can talk to each other
Try this one
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
namespace: default //your 1 namespaces on which you want to deny all traffic.
name: deny-from-other-namespaces
spec:
podSelector:
matchLabels:
ingress:
- from:
- podSelector: {}
Note a few things about this manifest: