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)
63 lines
2.1 KiB
YAML
63 lines
2.1 KiB
YAML
# Tenant isolation for `piedmont` (audit finding F3 / A5-1, card t_fed52919).
|
|
#
|
|
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the
|
|
# deny. `piedmont-allow` (CiliumNetworkPolicy) re-adds:
|
|
# ingress: the Cilium Gateway proxy (`reserved:ingress`) for
|
|
# piedmonthomesvc.com -> site:80 / contact:8090, plus node/health
|
|
# entities for kubelet probes.
|
|
# egress: cluster DNS; its own pods (nginx may proxy /api/contact in-namespace);
|
|
# and `world` for the Telegram Bot API used by piedmont-contact.
|
|
#
|
|
# `world` is everything outside the cluster (internet, LAN, VPN peers) but not
|
|
# other namespaces' pods and not node IPs, so the tenant boundary holds.
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: default-deny
|
|
namespace: piedmont
|
|
spec:
|
|
podSelector: {}
|
|
policyTypes:
|
|
- Ingress
|
|
- Egress
|
|
---
|
|
apiVersion: cilium.io/v2
|
|
kind: CiliumNetworkPolicy
|
|
metadata:
|
|
name: piedmont-allow
|
|
namespace: piedmont
|
|
spec:
|
|
description: >-
|
|
piedmont: gateway + kubelet ingress; egress to own namespace, cluster DNS
|
|
and the public internet only.
|
|
endpointSelector: {}
|
|
ingress:
|
|
- fromEntities:
|
|
- ingress
|
|
- host
|
|
- remote-node
|
|
- health
|
|
# Intra-namespace: nginx -> contact (and any future pod -> pod call). Cilium
|
|
# enforces policy at BOTH ends, so the same-namespace allow must exist in
|
|
# ingress as well as egress — measured: with only the egress rule, a pod in
|
|
# this namespace could not reach its own Service (TimeoutError).
|
|
- fromEndpoints:
|
|
- matchLabels:
|
|
io.kubernetes.pod.namespace: piedmont
|
|
egress:
|
|
- toEndpoints:
|
|
- matchLabels:
|
|
io.kubernetes.pod.namespace: kube-system
|
|
k8s-app: kube-dns
|
|
toPorts:
|
|
- ports:
|
|
- port: "53"
|
|
protocol: UDP
|
|
- port: "53"
|
|
protocol: TCP
|
|
- toEndpoints:
|
|
- matchLabels:
|
|
io.kubernetes.pod.namespace: piedmont
|
|
# Telegram Bot API (contact form delivery).
|
|
- toEntities:
|
|
- world
|