← All decisions jacob@stephens.page
Decision Record

Enforce cluster posture at admission over trusting reviewed manifests

ADR 0016 · Accepted ยท in production (public artifact: k3s-demo.stephens.page, github.com/JacobStephens2/k3s-demo) · ~1005 words

Context

The k3s-demo manifests already follow a hardened posture: containers run non-root, drop all Linux capabilities, mount a read-only root filesystem, declare CPU/memory requests and limits, carry liveness and readiness probes, and pin explicit image tags. All of it is visible in k8s/deployment.yaml and k8s/redis.yaml, and code review is supposed to keep it there.

Review is necessary but it is not a control. It depends on a human noticing, on every path into the cluster going through that human, and on nothing applying YAML out of band. None of that holds under pressure: a copied example reintroduces a root container, a hotfix drops the probe to "make it deploy," a future agent with apply rights edits a limit it does not understand. The posture is an intention written in a file, and an intention has no teeth when a non-compliant object reaches the API server.

That matters more once automated changes enter. The whole reason to put an agent near a cluster is to let it act without a human in the path for every change - which is exactly when "we review for this" stops being true. The control has to live where the change lands: admission.

Decision

Enforce the posture as policy-as-code at admission - the API server rejects a non-compliant workload before it runs - and treat the manifests' good behavior as something to verify, not trust.

Consequences

When I'd revisit

For a single-tenant cluster I fully control, with no automated apply path and a hard CI gate that renders and policy-checks every manifest before merge, the admission controller can be redundant with the pipeline - conftest/gator in CI catches the same violations earlier and cheaper, and a small cluster may not want a webhook in its critical path at all. The moment a second actor can apply - a teammate, a CD system, an agent - admission is where the control has to be, because it is the one place all of them share.


Seventh-boundary appendix

Every signature-system narrative and every ADR bridging to the new toolchain (Terraform IaC, K8s/OPA-Gatekeeper, Prometheus/Grafana) carries this appendix. It asks who is affected upstream and downstream of the automation, not only how it behaves.

One of a set of architecture decision records. Source markdown lives in the infrastructure-patterns repo, which is the canonical copy.