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)
80 lines
3 KiB
YAML
80 lines
3 KiB
YAML
# `customer1` tenant guardrails (audit finding F3 / A5-1, card t_fed52919).
|
||
#
|
||
# The sandbox is parked (`replicas: 0`, `suspend: true`, both committed in Git —
|
||
# see the README and the F21 note in the audit), so these numbers are derived
|
||
# from the DECLARED shape, not from `kubectl top` of a running tenant. Measured
|
||
# 2026-11-27 with `kubectl -n customer1 get deploy -o json` +
|
||
# `get cronjob pg-backup -o json`:
|
||
#
|
||
# workload requests limits replicas
|
||
# metabase 250m / 1Gi 1 CPU / 2Gi 0 (-> 1 when resumed)
|
||
# odoo 200m / 512Mi – / 2Gi 0 (-> 1)
|
||
# pg 100m / 256Mi – / 1Gi 0 (-> 1)
|
||
# pg-backup 50m / 128Mi – / 512Mi suspended Job
|
||
# ------------------------------------------------------------------
|
||
# total 600m / 1.88Gi 1 CPU / 5.5Gi at 1 replica + 1 Job
|
||
#
|
||
# The quota is the declared total with room for the one thing that always
|
||
# happens on a resumed stack: a RollingUpdate keeps maxSurge=25% of one replica
|
||
# alive next to the old pod. So requests get ~2x headroom (2 CPU / 4Gi), limits
|
||
# ~2x the declared peak (4 CPU / 10Gi) — a tenant cannot use more than two
|
||
# replicas' worth of anything at once, and a runaway pod is still cut off by its
|
||
# own limit, which is the LimitRange's job.
|
||
#
|
||
# Storage: 35Gi is already bound (odoo-data 10Gi + odoo-extra-addons 5Gi +
|
||
# pg-data 10Gi + backup-data 10Gi) — measured with `kubectl -n customer1 get
|
||
# pvc`. 45Gi allows exactly one more 10Gi claim and nothing more.
|
||
#
|
||
# Do not copy these numbers to another namespace: they describe this stack.
|
||
apiVersion: v1
|
||
kind: ResourceQuota
|
||
metadata:
|
||
name: customer1-quota
|
||
namespace: customer1
|
||
labels:
|
||
app.kubernetes.io/part-of: customer1
|
||
spec:
|
||
hard:
|
||
# Compute. Requests ~2x the declared 1-replica total (550m/1792Mi).
|
||
requests.cpu: "2"
|
||
requests.memory: 4Gi
|
||
limits.cpu: "4"
|
||
limits.memory: 10Gi
|
||
# Object counts. 3 workloads x 2 pods during a rolling update = 6, plus the
|
||
# pg-backup Job and room for one debug pod.
|
||
pods: "12"
|
||
count/jobs.batch: "8"
|
||
count/cronjobs.batch: "2"
|
||
services: "6"
|
||
# Storage: 35Gi bound -> one more 10Gi claim.
|
||
requests.storage: 45Gi
|
||
persistentvolumeclaims: "6"
|
||
---
|
||
# Container defaults so the quota above is satisfiable by every pod in the
|
||
# namespace: a ResourceQuota that constrains requests.cpu/limits.cpu rejects any
|
||
# pod without them, and the LimitRange injects them. `max` is the per-container
|
||
# ceiling — 2Gi is exactly metabase's declared limit, so the parked stack
|
||
# schedules unchanged when it is resumed; anything bigger now needs a namespace
|
||
# change on purpose.
|
||
apiVersion: v1
|
||
kind: LimitRange
|
||
metadata:
|
||
name: customer1-limits
|
||
namespace: customer1
|
||
labels:
|
||
app.kubernetes.io/part-of: customer1
|
||
spec:
|
||
limits:
|
||
- type: Container
|
||
defaultRequest:
|
||
cpu: 100m
|
||
memory: 128Mi
|
||
default:
|
||
cpu: 500m
|
||
memory: 512Mi
|
||
max:
|
||
cpu: "1"
|
||
memory: 2Gi
|
||
min:
|
||
cpu: 50m
|
||
memory: 64Mi
|