Audit F3 / A5-1. Every pod in customer1, osint, sirius-growth, piedmont,
siriusdevops and forgejo was reachable from every other pod, from the API
server, from the internal WireGuard-only Gateway ports on 10.10.0.2 and from
the internet.
- each namespace: a stock NetworkPolicy 'default-deny' (podSelector {},
Ingress+Egress, no rules) plus a CiliumNetworkPolicy allow that names the
gateway/kubelet/health entities, same-namespace pods, cluster DNS and only
the egress each workload actually uses (world for Telegram/news/inference,
remote-node :3900 for Garage, :22 for the backup rsync, kube-apiserver :6443
where CNPG/kubectl needs it, none at all for customer1)
- siriusdevops: replaces the egress-only siriusdevops-site-egress CNP
- customer1: ResourceQuota + LimitRange sized from the declared 1-replica
shape (35Gi already bound, 2 CPU / 4Gi requests) - the sandbox stays parked
- docs/network-isolation.md: the model plus the five gotchas measured while
landing it (both-ends enforcement, kube-apiserver identity covering the
whole node IP, remote-node vs world for Garage, ingress vs host identity)
5.7 KiB
Namespace network isolation
State since 2026-11-27 (audit finding F3 / A5-1, card t_fed52919). Before that the cluster
was one flat L2/L3 domain: a pod in any namespace could reach every other namespace's services, the
API server, the internal Gateway ports on 10.10.0.2 (:8081 Grafana, :8084 Hubble,
:8085 Metabase, :8086/:8087 customer1) and the internet.
What is covered
Each app namespace carries two objects in apps/base/<ns>/networkpolicy.yaml,
applied by the apps Flux Kustomization:
| namespace | default-deny | allow policy | internet egress | Garage/S3 | CI/backup SSH | API |
|---|---|---|---|---|---|---|
customer1 |
yes | customer1-allow |
no (by design) | no | no | no |
osint |
yes | osint-allow |
yes | no | no | no |
sirius-growth |
yes | sirius-growth-allow |
yes | 3900 | 22 | yes |
piedmont |
yes | piedmont-allow |
yes | no | no | no |
siriusdevops |
yes | siriusdevops-allow |
yes | 3900 | no | no |
forgejo |
yes | forgejo-allow |
yes | no | 22 | yes |
customer1 also carries quota.yaml: a ResourceQuota + LimitRange sized from the declared
1-replica shape of the parked sandbox (2 CPU / 4Gi requests, 4 CPU / 10Gi limits, 45Gi storage,
max 1 CPU / 2Gi per container). See the comments in that file for the arithmetic.
metabase, monitoring, logging, kube-system, ci-runners, netsec and secops are not
isolated yet — they are the next tier (monitoring/logging legitimately reach everything).
How the deny is expressed
- Deny:
networking.k8s.io/v1 NetworkPolicynameddefault-deny,podSelector: {},policyTypes: [Ingress, Egress], no rules. A stock NetworkPolicy is unambiguous in Cilium's k8s-policy path, and unlike aCiliumClusterwideNetworkPolicywithendpointSelector: {}it cannot silently selectkube-system/CoreDNS/Flux. - Allow:
CiliumNetworkPolicyper namespace withendpointSelector: {}. Cilium unions all policies that select an endpoint, so deny + allow = the effective policy. The Cilium CRD is needed because the permitted sources/destinations are Cilium entities.
The five rules every namespace needs
ingress:
- fromEntities: [ingress, host, remote-node, health] # Gateway proxy + kubelet + cilium-health
- fromEndpoints: # INTRA-NAMESPACE, see below
- matchLabels: {io.kubernetes.pod.namespace: <ns>}
egress:
- toEndpoints: kube-dns :53 (UDP+TCP)
- toEndpoints: own namespace
- toEntities: [world] # internet + LAN + VPN peers, NOT pods/nodes
Entities that matter here:
| entity | what it is | why it appears |
|---|---|---|
ingress |
Cilium Gateway/listener proxy | measured: hubble observe --to-namespace forgejo --to-port 3000 shows the source identity as reserved:ingress (identity 8), not host. Traffic arrives via cloudflared → hostNetwork Envoy → pod. |
host |
the local node IP | kubelet probes and host-network datapath |
remote-node |
other nodes' IPs | cross-node gateway ingress; Garage (10.10.0.1, 10.10.0.5) and the Linode SSH target live here, not in world |
kube-apiserver |
the apiserver identity | attached to the whole node IP 10.10.0.2 because apiserver is host-networked — always port-scope it (see below) |
health |
cilium-health | inter-node health probes |
Gotchas that cost time (all measured 2026-11-27)
- Cilium enforces at both ends. An egress rule alone does not let a pod reach its own
Service: the destination pod's ingress policy must allow it too. Symptom: a probe pod in the
namespace gets
TimeoutErroronown-service.<ns>.svc:5432while the public route works fine (that one enters asingress). Add the same-namespacefromEndpointsingress rule as well. Confirmed by re-running the probe after adding it:OPEN. toEntities: [kube-apiserver]withouttoPortsopens the whole gateway node. The apiserver is host-networked on10.10.0.2, and Cilium attaches thekube-apiserveridentity to that IP, so an unscoped rule also allowed:8085,:8081,:9100,:10250. Measured, then fixed withtoPorts: [6443, 443](443 = the service port the CNPG instance manager /kubectldial; 6443 = the backend port). Re-probe:apiserver OPEN,:8085/:8081/:9100/:10250 CLOSED.ipBlock/toCIDRis inert for node IPs.10.10.0.1(Garage on the Pi) resolves toreserved:remote-node, and CIDR rules are only evaluated forreserved:world. UsetoEntities: [remote-node]+toPorts.worldis not "the internet". It is everything outside the cluster: public IPs and the LAN (192.168.1.0/24) and VPN peers. Cluster pods and node IPs are not inworld, which is what makestoEntities: [world]a safe "internet only" rule.- A deny shows up as
TimeoutError, an empty Service asConnectionRefusedError. Useful when reading probes:pg.customer1.svc:5432refusing proves the policy permits the path and the namespace is simply parked at 0 replicas.
Adding a dependency
- Add the rule to that namespace's allow policy — DNS, same-namespace and the entity list are
already there; most additions are one
toEntities/toPortsblock. - Prove it both ways: the new path must go
OPEN, andforgejo:3000,metabase:3000,grafana:80,kubernetes.default:443(where not needed) and10.10.0.2:8085must stayCLOSEDfrom that namespace. - Watch the deny side while you test:
hubble observe --verdict DROPPED -o compacton the namespace you changed (policy-verdict:...DENIEDlines name the exact port). - Push through a PR; Flux owns the objects. A
kubectl applyis only for testing and will be adopted by the next reconcile.