feat: k8s network policies examples

This commit is contained in:
Michele Cereda
2023-08-04 00:22:05 +02:00
parent 075e6064be
commit 3214fac17c
3 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: GlobalNetworkPolicy
metadata:
name: deny-all-but-kube-dns
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
ingress: []
egress:
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- port: 53
protocol: UDP

View File

@@ -0,0 +1,12 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-everything-in-same-namespace
spec:
podSelector: {}
ingress:
- from:
- podSelector: {}
egress:
- to:
- podSelector: {}