Roadmap 2.3: Fix violations and switch Kyverno policies from Audit to Enforce #85

Open
opened 2026-12-03 04:39:33 +01:00 by claude-bot · 0 comments

Why

Policies in audit mode only report. The goal is enforcement without breaking running services, which is exactly the rollout problem companies face.

Enterprise practice: staged rollout (audit → fix → enforce) with documented, time-boxed exceptions.

Depends on kasun/homelab-infrastructure-as-code#84 and kasun/homelab-ansible#19 (Renovate pins the image digests).

Steps

  • Work through the policy reports namespace by namespace: add securityContext (non-root, read-only root fs where possible, drop capabilities), requests/limits, digests
  • For workloads that legitimately need an exception, add a PolicyException with a reason in a comment
  • Switch policies to Enforce one at a time and watch for rejected deployments
  • Demo: kubectl run a privileged pod and a :latest image; both are rejected with a clear message

Tools

Kyverno, kubectl.

Done when

  • All roadmap policies run in Enforce
  • Violations are at zero apart from documented exceptions
  • pulumi up for all stacks still passes

Portfolio evidence

  • Violation count before/after
  • Screenshot of a rejected pod
  • Decision record: rollout approach and exception handling

Part of the security roadmap. Keep the evidence below for the write-up (README / blog post).

## Why Policies in audit mode only report. The goal is enforcement without breaking running services, which is exactly the rollout problem companies face. **Enterprise practice:** staged rollout (audit → fix → enforce) with documented, time-boxed exceptions. Depends on kasun/homelab-infrastructure-as-code#84 and kasun/homelab-ansible#19 (Renovate pins the image digests). ## Steps - [ ] Work through the policy reports namespace by namespace: add `securityContext` (non-root, read-only root fs where possible, drop capabilities), requests/limits, digests - [ ] For workloads that legitimately need an exception, add a `PolicyException` with a reason in a comment - [ ] Switch policies to `Enforce` one at a time and watch for rejected deployments - [ ] Demo: `kubectl run` a privileged pod and a `:latest` image; both are rejected with a clear message ## Tools Kyverno, kubectl. ## Done when - All roadmap policies run in `Enforce` - Violations are at zero apart from documented exceptions - `pulumi up` for all stacks still passes ## Portfolio evidence - [ ] Violation count before/after - [ ] Screenshot of a rejected pod - [ ] Decision record: rollout approach and exception handling --- _Part of the security roadmap. Keep the evidence below for the write-up (README / blog post)._
claude-bot Bot added this to the Security Roadmap 2: Policy as code in Kubernetes milestone 2026-12-03 04:39:33 +01:00
claude-bot Bot added the
Priority
Medium
3
Kind/Securitysecurity-roadmap
labels 2026-12-03 04:39:33 +01:00
claude-bot Bot added this to the Security Roadmap project 2026-12-03 04:39:38 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kasun/homelab-infrastructure-as-code#85