Nothing in the cluster currently stops a privileged pod, a :latest image or a container running as root. An admission controller enforces security rules on every resource, whoever or whatever creates it.
Enterprise practice: policy as code with an admission controller, rolled out in audit mode first.
Steps
Add the kyverno Helm chart (pinned version) to 03-k8s-infra, namespace kyverno
Add the kyverno-policies chart with podSecurityStandard: restricted and validationFailureAction: Audit
Exclude system namespaces that legitimately need privileges (kube-system, longhorn-system, kube-vip) via the chart's exclusions, with a comment why
Enable Kyverno's ServiceMonitors so kube-prometheus-stack scrapes them (check the release label / serviceMonitorSelector)
Optional: Policy Reporter UI to browse results
Tools
Kyverno, Pulumi (Helm), Prometheus.
Done when
kubectl get policyreport -A shows results for all app namespaces
The list of current violations per namespace is written down (input for 2.3)
Portfolio evidence
Screenshot of the policy reports / Policy Reporter
Number of violations at the start (baseline)
Part of the security roadmap. Keep the evidence below for the write-up (README / blog post).
## Why
Nothing in the cluster currently stops a privileged pod, a `:latest` image or a container running as root. An admission controller enforces security rules on every resource, whoever or whatever creates it.
**Enterprise practice:** policy as code with an admission controller, rolled out in audit mode first.
## Steps
- [ ] Add the `kyverno` Helm chart (pinned version) to `03-k8s-infra`, namespace `kyverno`
- [ ] Add the `kyverno-policies` chart with `podSecurityStandard: restricted` and `validationFailureAction: Audit`
- [ ] Exclude system namespaces that legitimately need privileges (`kube-system`, `longhorn-system`, kube-vip) via the chart's exclusions, with a comment why
- [ ] Enable Kyverno's ServiceMonitors so `kube-prometheus-stack` scrapes them (check the `release` label / `serviceMonitorSelector`)
- [ ] Optional: Policy Reporter UI to browse results
## Tools
Kyverno, Pulumi (Helm), Prometheus.
## Done when
- `kubectl get policyreport -A` shows results for all app namespaces
- The list of current violations per namespace is written down (input for 2.3)
## Portfolio evidence
- [ ] Screenshot of the policy reports / Policy Reporter
- [ ] Number of violations at the start (baseline)
---
_Part of the security roadmap. Keep the evidence below for the write-up (README / blog post)._
claude-botBot
added this to the Security Roadmap 2: Policy as code in Kubernetes milestone 2026-12-03 04:39:32 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
Nothing in the cluster currently stops a privileged pod, a
:latestimage or a container running as root. An admission controller enforces security rules on every resource, whoever or whatever creates it.Enterprise practice: policy as code with an admission controller, rolled out in audit mode first.
Steps
kyvernoHelm chart (pinned version) to03-k8s-infra, namespacekyvernokyverno-policieschart withpodSecurityStandard: restrictedandvalidationFailureAction: Auditkube-system,longhorn-system, kube-vip) via the chart's exclusions, with a comment whykube-prometheus-stackscrapes them (check thereleaselabel /serviceMonitorSelector)Tools
Kyverno, Pulumi (Helm), Prometheus.
Done when
kubectl get policyreport -Ashows results for all app namespacesPortfolio evidence
Part of the security roadmap. Keep the evidence below for the write-up (README / blog post).