JakeUT
JakeUT

Reputation: 537

Kubernetes NetworkPolicy for current namespace

When creating a networkpolicy for pods in the same namespace to talk to each other, should I add the current namespace to the From Block?

So lets say I have PodA and PodB in NamespaceX, do I have to explicitly add NamespaceX to the From Block to allow all pods within the Namespace to talk to each other?

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: my-network-policy
  namespace: NamespaceX
spec:
  podSelector:
    matchLabels:
      app: MyApp
  policyTypes:
  - Ingress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: NamespaceX   <==== Needed for pods in the same NS to talk to each other???

Thanks in advance

Upvotes: 0

Views: 101

Answers (0)

Related Questions