Roadmap 2.2: Add custom Kyverno policies for image pinning and workload hardening #84

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

Why

The Pod Security Standards cover container privileges, but not supply-chain rules. Custom policies tie the cluster to roadmap step 1: only pinned images, no :latest, sane resource limits.

Enterprise practice: organisation-specific policies kept in git, tested in CI, deployed like any other code.

Depends on kasun/homelab-infrastructure-as-code#83.

Steps

  • Policies as YAML files in the repo, deployed from 03-k8s-infra (audit mode):
    • disallow-latest-tag
    • require-image-digest (images must match *@sha256:*)
    • disallow-privileged-containers
    • require-run-as-nonroot
    • require-requests-limits
  • Add test cases (good and bad manifests) and run kyverno test in CI on every PR
  • Each policy has title, description and severity annotations

Tools

Kyverno, Kyverno CLI, Gitea Actions.

Done when

  • The policies are active in audit mode and appear in the policy reports
  • A PR with a broken policy fails kyverno test

Portfolio evidence

  • The policy files and test cases in the repo

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

## Why The Pod Security Standards cover container privileges, but not supply-chain rules. Custom policies tie the cluster to roadmap step 1: only pinned images, no `:latest`, sane resource limits. **Enterprise practice:** organisation-specific policies kept in git, tested in CI, deployed like any other code. Depends on kasun/homelab-infrastructure-as-code#83. ## Steps - [ ] Policies as YAML files in the repo, deployed from `03-k8s-infra` (audit mode): - [ ] `disallow-latest-tag` - [ ] `require-image-digest` (images must match `*@sha256:*`) - [ ] `disallow-privileged-containers` - [ ] `require-run-as-nonroot` - [ ] `require-requests-limits` - [ ] Add test cases (good and bad manifests) and run `kyverno test` in CI on every PR - [ ] Each policy has `title`, `description` and `severity` annotations ## Tools Kyverno, Kyverno CLI, Gitea Actions. ## Done when - The policies are active in audit mode and appear in the policy reports - A PR with a broken policy fails `kyverno test` ## Portfolio evidence - [ ] The policy files and test cases in the repo --- _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:32 +01:00
claude-bot Bot added the
Priority
Medium
3
Kind/Securitysecurity-roadmap
labels 2026-12-03 04:39:32 +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#84