- 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
44 lines
1 KiB
YAML
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
|