On an Azure AKS cluster with the Calico network policies plugin enabled, I want to:
- by default block all incoming traffic.
- allow all traffic within a namespace (from a pod in a namespace, to another pod in the same namespace.
I tried something like:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny.all
namespace: test
spec:
podSelector: {}
policyTypes:
- Ingress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow.same.namespace
namespace: test
spec:
podSelector: {}
ingress:
- from:
- podSelector: {}
policyTypes:
- Ingress
But is seems to block traffic between two deployments/pods in the same namespace. What am I doing wrong, am I misreading the documentation?
Perhaps it is good to mention that the above setup seems to work on an AWS EKS based Kubernetes cluster.