115 lines
2.1 KiB
YAML
115 lines
2.1 KiB
YAML
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: default-deny-ingress
|
|
namespace: dawarich
|
|
spec:
|
|
podSelector: {}
|
|
policyTypes:
|
|
- Ingress
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-ingress-controller
|
|
namespace: dawarich
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
app: dawarich
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
- from:
|
|
- namespaceSelector:
|
|
matchLabels:
|
|
kubernetes.io/metadata.name: traefik
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-app-to-db
|
|
namespace: dawarich
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
app: dawarich-db
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
- from:
|
|
- podSelector:
|
|
matchLabels:
|
|
app: dawarich
|
|
ports:
|
|
- port: 5432
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-backup-to-db
|
|
namespace: dawarich
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
app: dawarich-db
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
- from:
|
|
- podSelector:
|
|
matchLabels:
|
|
app: dawarich-backup
|
|
ports:
|
|
- port: 5432
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-backup-egress
|
|
namespace: dawarich
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
app: dawarich-backup
|
|
policyTypes:
|
|
- Egress
|
|
egress:
|
|
- ports:
|
|
- port: 53
|
|
protocol: UDP
|
|
- port: 53
|
|
protocol: TCP
|
|
- ports:
|
|
- port: 8888
|
|
protocol: TCP
|
|
- ports:
|
|
- port: 443
|
|
protocol: TCP
|
|
- ports:
|
|
- port: 5432
|
|
protocol: TCP
|
|
to:
|
|
- podSelector:
|
|
matchLabels:
|
|
app: dawarich-db
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: allow-app-to-redis
|
|
namespace: dawarich
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
app: dawarich-redis
|
|
policyTypes:
|
|
- Ingress
|
|
ingress:
|
|
- from:
|
|
- podSelector:
|
|
matchLabels:
|
|
app: dawarich
|
|
ports:
|
|
- port: 6379
|