{ "apiVersion": "networking.k8s.io/v1", "kind": "NetworkPolicy", "metadata": { "name": "audit-core-migrate-egress", "namespace": "audit-core" }, "spec": { "podSelector": { "matchLabels": { "app.kubernetes.io/name": "audit-core", "app.kubernetes.io/component": "migrate" } }, "policyTypes": [ "Egress" ], "egress": [ { "to": [ { "namespaceSelector": { "matchLabels": { "kubernetes.io/metadata.name": "databases" } }, "podSelector": { "matchLabels": { "cnpg.io/cluster": "platform-pg" } } } ], "ports": [ { "protocol": "TCP", "port": 5432 } ] }, { "to": [ { "namespaceSelector": { "matchLabels": { "kubernetes.io/metadata.name": "kube-system" } }, "podSelector": { "matchLabels": { "k8s-app": "kube-dns" } } } ], "ports": [ { "protocol": "UDP", "port": 53 }, { "protocol": "TCP", "port": 53 } ] } ] } }