NetworkPolicy

This commit is contained in:
Raiko Oll
2026-02-17 14:53:58 +02:00
parent 46807f93d9
commit 3d6b022cad

View File

@@ -31,18 +31,46 @@ spec:
matchLabels: matchLabels:
cnpg.io/cluster: memelord-raiko-database cnpg.io/cluster: memelord-raiko-database
policyTypes: policyTypes:
- Ingress - Ingress
ingress: ingress:
- from: # App -> Postgres SQL
- podSelector: - from:
matchLabels: - podSelector:
app: memelord matchLabels:
- podSelector: # Primary-secondary replication! app: memelord
matchLabels: ports:
cnpg.io/cluster: memelord-raiko-database - protocol: TCP
ports: port: 5432
- protocol: TCP
port: 5432 # Primary-secondary replication (jääb alles)
- from:
- podSelector:
matchLabels:
cnpg.io/cluster: memelord-raiko-database
ports:
- protocol: TCP
port: 5432
# CNPG operator/controller -> Postgres management/health (sinu log näitas port 8000)
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: cnpg-system
ports:
- protocol: TCP
port: 8000
# Prometheus -> Postgres (vali õige port vastavalt exporterile/metricsile)
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: monitoring
ports:
- protocol: TCP
port: 5432
# - protocol: TCP
# port: 9187
--- ---
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: NetworkPolicy kind: NetworkPolicy
@@ -63,3 +91,4 @@ spec:
ports: ports:
- protocol: TCP - protocol: TCP
port: 8000 port: 8000