Phase 8a: Platform namespace NetworkPolicies in Terraform #76
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-platform#76
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
plan-pal-e-platform→ Phase 8 (Network Security Hardening) → Phase 8a (NetworkPolicy — Pod-Level Isolation) → Deliverable 3Repo
forgejo_admin/pal-e-platformUser Story
As a platform operator
I want NetworkPolicies on all platform namespaces (monitoring, argocd, harbor, etc.)
So that platform infrastructure pods are isolated from unauthorized cross-namespace traffic
Context
Service namespaces (6) already have default-deny ingress via kustomize base (PR #7 on pal-e-deployments, merged 2026-03-15). Platform namespaces (10) still have NO NetworkPolicies — they're managed by Terraform, not kustomize.
The full traffic map is documented in
doc-network-traffic-map(pal-e-docs). Key design decisions:kubernetes.io/metadata.namelabel (auto-set by k8s API server, verified)File Targets
Files to create:
terraform/network-policies.tf— all platform namespace NetworkPoliciesFiles NOT to touch:
terraform/main.tf— no changes needed (namespaces already exist)terraform/variables.tf— no new variablesterraform/Acceptance Criteria
network-policies.tfcontainskubernetes_manifestresources for all 10 platform namespacestofu validatepassestofu fmtpassestofu planshows only NetworkPolicy additions (no modifications to existing resources)policyTypes: ["Ingress"]only (no egress restriction)Test Expectations
tofu validateinterraform/directorytofu planoutput shows ~10 newkubernetes_manifestresources, 0 changes, 0 destroyscd terraform && tofu validate && tofu plan -var-file=k3s.tfvarsConstraints
kubernetes_manifestpattern from main.tf (see CNPG Cluster at line ~1462, PrometheusRule at line ~486)kubernetes_namespace_v1.<name>.metadata[0].namedepends_onto reference the namespace resourcekubernetes_network_policyresource — usekubernetes_manifestfor consistency with existing patternsnetwork-policies.tf— do NOT add to main.tf (already 2200+ lines)Traffic Map (from doc-network-traffic-map)
monitoring — allow from: tailscale (grafana:80, alertmanager:9093), same-namespace (all internal mesh). Note: Prometheus cross-namespace EGRESS is not restricted.
argocd — allow from: tailscale (argocd-server:80,443), same-namespace (all internal mesh).
forgejo — allow from: tailscale (forgejo-http:80), woodpecker namespace (forgejo-http:80 for clone).
woodpecker — allow from: tailscale (woodpecker-server:80), same-namespace (agent→server:9000, server→db:5432).
harbor — allow from: tailscale (harbor-nginx:80), same-namespace (all internal mesh), monitoring (harbor pods:8001 for metrics scrape).
minio — allow from: tailscale (minio:9000,9001), postgres namespace (CNPG backup:9000), woodpecker namespace (CNPG backup:9000).
keycloak — allow from: tailscale (keycloak:80).
postgres — allow from: pal-e-docs namespace (pal-e-postgres-rw:5432), cnpg-system namespace (operator:5432).
ollama — allow from: pal-e-docs namespace (ollama:11434 for embedding worker).
cnpg-system — allow from: kube-system (webhook callbacks:443). Note: operator EGRESS to postgres/woodpecker namespaces is not restricted.
Checklist
Related
pal-e-platform— parent projectdoc-network-traffic-map— traffic assessment docphase-pal-e-platform-network-security— phase noteReading issue body for review context...