gcloud-lab/apps/base/customer1/waitlist-api/network-policy.yaml
Sirius Devops ac994f144a fix: container hardening + NetworkPolicy for waitlist-api
- deployment.yaml: securityContext (runAsNonRoot, readOnlyRootFilesystem, drop ALL caps)
- network-policy.yaml: egress only to CNPG PG (5432) + api.telegram.org (443)
- kustomization.yaml: register new NetworkPolicy resource
- waitlist-telegram-secret: add admin_api_key field
2026-05-15 00:00:58 +00:00

44 lines
1 KiB
YAML

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: waitlist-api-egress
namespace: customer1
spec:
podSelector:
matchLabels:
app: waitlist-api
policyTypes:
- Egress
egress:
# Allow DNS resolution (required for api.telegram.org lookups)
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
- podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53
# Allow PostgreSQL to CNPG cluster
- to:
- podSelector:
matchLabels:
cnpg.io/cluster: siriusdevops-pgdb
ports:
- protocol: TCP
port: 5432
# Allow Telegram Bot API
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
ports:
- protocol: TCP
port: 443