2026-05-21 04:08:58 +00:00
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
|
kind: NetworkPolicy
|
|
|
|
|
metadata:
|
|
|
|
|
name: trading-platform-netpol
|
|
|
|
|
namespace: customer1
|
|
|
|
|
spec:
|
|
|
|
|
podSelector:
|
|
|
|
|
matchExpressions:
|
|
|
|
|
- key: app
|
|
|
|
|
operator: In
|
|
|
|
|
values:
|
|
|
|
|
- trading-data-service
|
|
|
|
|
- trading-execute-service
|
|
|
|
|
- trading-news-service
|
|
|
|
|
- trading-dashboard
|
|
|
|
|
policyTypes:
|
|
|
|
|
- Ingress
|
|
|
|
|
- Egress
|
|
|
|
|
ingress:
|
|
|
|
|
# Allow from Gateway / ingress controller
|
|
|
|
|
- from:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
kubernetes.io/metadata.name: customer1
|
|
|
|
|
ports:
|
2026-05-25 07:05:45 +00:00
|
|
|
- port: 3000
|
|
|
|
|
protocol: TCP
|
2026-05-21 04:08:58 +00:00
|
|
|
- port: 8000
|
|
|
|
|
protocol: TCP
|
2026-05-25 07:15:59 +00:00
|
|
|
- port: 8001
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8002
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8003
|
|
|
|
|
protocol: TCP
|
|
|
|
|
# Allow from Tailscale proxy namespace
|
|
|
|
|
- from:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
kubernetes.io/metadata.name: tailscale
|
|
|
|
|
ports:
|
|
|
|
|
- port: 3000
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8000
|
|
|
|
|
protocol: TCP
|
2026-05-21 04:08:58 +00:00
|
|
|
- port: 8001
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8002
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8003
|
|
|
|
|
protocol: TCP
|
|
|
|
|
# Allow inter-service communication
|
|
|
|
|
- from:
|
|
|
|
|
- podSelector:
|
|
|
|
|
matchExpressions:
|
|
|
|
|
- key: app
|
|
|
|
|
operator: In
|
|
|
|
|
values:
|
|
|
|
|
- trading-data-service
|
|
|
|
|
- trading-execute-service
|
|
|
|
|
- trading-news-service
|
|
|
|
|
- trading-dashboard
|
|
|
|
|
ports:
|
2026-05-25 07:05:45 +00:00
|
|
|
- port: 3000
|
|
|
|
|
protocol: TCP
|
2026-05-21 04:08:58 +00:00
|
|
|
- port: 8000
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8001
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8002
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8003
|
|
|
|
|
protocol: TCP
|
|
|
|
|
egress:
|
|
|
|
|
# Allow DNS
|
|
|
|
|
- to:
|
|
|
|
|
- namespaceSelector: {}
|
|
|
|
|
podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
k8s-app: kube-dns
|
|
|
|
|
ports:
|
|
|
|
|
- port: 53
|
|
|
|
|
protocol: UDP
|
|
|
|
|
- port: 53
|
|
|
|
|
protocol: TCP
|
|
|
|
|
# Allow DB access
|
|
|
|
|
- to:
|
|
|
|
|
- podSelector:
|
|
|
|
|
matchLabels:
|
2026-05-25 20:08:07 +00:00
|
|
|
cnpg.io/cluster: siriusdevops-pgdb
|
2026-05-21 04:08:58 +00:00
|
|
|
ports:
|
|
|
|
|
- port: 5432
|
|
|
|
|
protocol: TCP
|
|
|
|
|
# Allow Redis access
|
|
|
|
|
- to:
|
|
|
|
|
- podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app: trading-redis
|
|
|
|
|
ports:
|
|
|
|
|
- port: 6379
|
|
|
|
|
protocol: TCP
|
2026-05-27 14:19:26 +00:00
|
|
|
# Allow Kafka access (Strimzi labels)
|
2026-05-21 04:08:58 +00:00
|
|
|
- to:
|
|
|
|
|
- podSelector:
|
|
|
|
|
matchLabels:
|
2026-05-27 14:19:26 +00:00
|
|
|
strimzi.io/name: trading-kafka
|
|
|
|
|
ports:
|
|
|
|
|
- port: 9092
|
|
|
|
|
protocol: TCP
|
|
|
|
|
# Allow Kafka bootstrap service (fallback)
|
|
|
|
|
- to:
|
|
|
|
|
- podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
strimzi.io/cluster: trading-kafka
|
2026-05-21 04:08:58 +00:00
|
|
|
ports:
|
|
|
|
|
- port: 9092
|
|
|
|
|
protocol: TCP
|
2026-05-29 13:16:35 +00:00
|
|
|
# Allow inter-service egress (via ClusterIP services on port 80, plus direct pod ports)
|
2026-05-21 04:08:58 +00:00
|
|
|
- to:
|
|
|
|
|
- podSelector:
|
|
|
|
|
matchExpressions:
|
|
|
|
|
- key: app
|
|
|
|
|
operator: In
|
|
|
|
|
values:
|
|
|
|
|
- trading-data-service
|
|
|
|
|
- trading-execute-service
|
|
|
|
|
- trading-news-service
|
|
|
|
|
- trading-dashboard
|
|
|
|
|
ports:
|
2026-05-29 13:16:35 +00:00
|
|
|
- port: 80
|
|
|
|
|
protocol: TCP
|
2026-05-21 04:08:58 +00:00
|
|
|
- port: 8000
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8001
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8002
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 8003
|
|
|
|
|
protocol: TCP
|
2026-05-27 19:34:04 +00:00
|
|
|
# Allow external HTTPS/WSS (Helius, Solana, Jupiter, Hyperliquid APIs)
|
|
|
|
|
- to: []
|
|
|
|
|
ports:
|
|
|
|
|
- port: 443
|
|
|
|
|
protocol: TCP
|
|
|
|
|
- port: 80
|
|
|
|
|
protocol: TCP
|