CKS Network policy content issue (in video "Developing Network Policies")

In the above video, it is said that when only “podSelector” is specified in “ingress.from” rule, it allows “any pod from any namespace with matching labels to reach the pod at the port”. However the Kubernetes documentation (Network Policies | Kubernetes) says the following

podSelector : This selects particular Pods in the same namespace as the NetworkPolicy which should be allowed as ingress sources or egress destinations.

It specifically mentions same namespace.

Hello @su0 ,

Thanks for sharing your experience , we will consider your review in the next updates.

You can check the example below to allow trafic from any namespaces.

kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
  namespace: default
  name: web-allow-all-namespaces
spec:
  podSelector:
    matchLabels:
      app: web
  ingress:
  - from:
    - namespaceSelector: {}
  • namespaceSelector: {} Selects all pods in all namespaces.
  • By default, if you omit specifying a namespaceSelector it does not select any namespaces, which means it will allow traffic only from the namespace the NetworkPolicy is deployed to.

Thanks,
KodeKloud Support