NetworkPolicy

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

View File

@@ -33,16 +33,44 @@ spec:
policyTypes: policyTypes:
- Ingress - Ingress
ingress: ingress:
# App -> Postgres SQL
- from: - from:
- podSelector: - podSelector:
matchLabels: matchLabels:
app: memelord app: memelord
- podSelector: # Primary-secondary replication! ports:
- protocol: TCP
port: 5432
# Primary-secondary replication (jääb alles)
- from:
- podSelector:
matchLabels: matchLabels:
cnpg.io/cluster: memelord-raiko-database cnpg.io/cluster: memelord-raiko-database
ports: ports:
- protocol: TCP - protocol: TCP
port: 5432 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