2026-08-19 20:52:13 -07:00
|
|
|
apiVersion: networking.k8s.io/v1
|
|
|
|
|
kind: NetworkPolicy
|
|
|
|
|
metadata:
|
|
|
|
|
name: api-gateway
|
|
|
|
|
namespace: api
|
|
|
|
|
labels:
|
|
|
|
|
app: api-gateway
|
|
|
|
|
spec:
|
|
|
|
|
podSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app: api-gateway
|
|
|
|
|
policyTypes:
|
|
|
|
|
- Ingress
|
|
|
|
|
- Egress
|
|
|
|
|
ingress:
|
|
|
|
|
# Allow from ingress-nginx controller (from ingress-nginx namespace)
|
|
|
|
|
- from:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
name: ingress-nginx
|
|
|
|
|
ports:
|
|
|
|
|
- protocol: TCP
|
|
|
|
|
port: 8080
|
|
|
|
|
# Allow from Prometheus scraping (if in monitoring namespace)
|
|
|
|
|
- from:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
name: monitoring
|
|
|
|
|
ports:
|
|
|
|
|
- protocol: TCP
|
|
|
|
|
port: 8080
|
|
|
|
|
egress:
|
2026-08-26 16:21:58 -07:00
|
|
|
# Kubernetes API server egress is handled by CiliumNetworkPolicy
|
|
|
|
|
# (k8s/cilium-netpol.yaml) using toEntities: kube-apiserver.
|
|
|
|
|
# Standard NetworkPolicy ipBlock doesn't work with Cilium for service VIPs.
|
2026-08-19 20:52:13 -07:00
|
|
|
# Allow DNS
|
|
|
|
|
- to:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
2026-08-20 00:04:17 -07:00
|
|
|
kubernetes.io/metadata.name: kube-system
|
2026-08-19 20:52:13 -07:00
|
|
|
ports:
|
|
|
|
|
- protocol: UDP
|
|
|
|
|
port: 53
|
2026-08-20 00:04:17 -07:00
|
|
|
- protocol: TCP
|
|
|
|
|
port: 53
|
2026-08-19 20:52:13 -07:00
|
|
|
# Allow to upstreams (LLM services in llm-serving namespace)
|
|
|
|
|
- to:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
2026-08-20 00:04:17 -07:00
|
|
|
kubernetes.io/metadata.name: llm-serving
|
2026-08-19 20:52:13 -07:00
|
|
|
ports:
|
|
|
|
|
- protocol: TCP
|
|
|
|
|
port: 80
|
|
|
|
|
- protocol: TCP
|
|
|
|
|
port: 8000
|
|
|
|
|
- protocol: TCP
|
|
|
|
|
port: 8001
|
|
|
|
|
# Allow to other upstreams if needed (embeddings, reranker, etc.)
|
|
|
|
|
- to:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
2026-08-20 00:04:17 -07:00
|
|
|
kubernetes.io/metadata.name: llm-serving
|
2026-08-19 20:52:13 -07:00
|
|
|
ports:
|
|
|
|
|
- protocol: TCP
|
|
|
|
|
port: 8080
|
|
|
|
|
# Allow to atlas (riotpiao-backend) for /cluster/* routes
|
|
|
|
|
- to:
|
|
|
|
|
- namespaceSelector:
|
|
|
|
|
matchLabels:
|
2026-08-20 00:04:17 -07:00
|
|
|
kubernetes.io/metadata.name: atlas
|
2026-08-19 20:52:13 -07:00
|
|
|
ports:
|
|
|
|
|
- protocol: TCP
|
|
|
|
|
port: 8080
|