Chapter 15: Admission Policy Guardrails (Advanced)

Why This Chapter Exists

Local checks (pre-commit, CI, review) reduce risk but can be bypassed. Admission control is the last enforcement point before runtime.

This chapter focuses on policy-as-code guardrails that block risky workloads even when upstream checks fail.

Learning Objectives

By the end of this chapter, learners can:

  • explain why cluster-side policy is mandatory in production systems
  • roll out Kyverno rules with Audit -> Enforce safely
  • troubleshoot deny events and remediate manifests correctly
  • run controlled break-glass exceptions with expiry and audit trail

The Incident Hook

A workload is deployed during incident pressure with missing limits, mutable tags, and weak security context. Workstation hooks were skipped and review focused on speed. The pod starts in a risky configuration and causes noisy-neighbor impact. Recovery is slowed because the team lacks clear deny/exception discipline.

What AI Would Propose (Brave Junior)

  • “Disable the policy engine temporarily.”
  • “Allow privileged mode now, fix later.”
  • “Create a broad exception for the whole namespace.”

Why this sounds reasonable:

  • immediate progress under pressure
  • lower friction in the moment

Why This Is Dangerous

  • Security and stability regressions reach runtime.
  • “Temporary” exceptions become long-term drift.
  • Platform trust model is weakened for all teams.

Guardrails That Stop It

  • Policy engine always-on (Kyverno).
  • Default rollout path: Audit then selective Enforce.
  • Exceptions must be scoped, time-bound, and approved.
  • Deny evidence is mandatory before policy changes.

Platform Baseline

Repository Mapping

Safe Workflow (Step-by-Step)

  1. Enable selected policies in Audit.
  2. Trigger known violations intentionally in develop.
  3. Review policy reports and event messages.
  4. Fix manifests, not engine settings.
  5. Move stable rules to Enforce in non-production.
  6. Promote enforcement gradually across environments.

Lab Files

  • lab.md
  • runbook-admission-policy.md
  • quiz.md

Done When

  • learner demonstrates Audit -> Enforce with clear evidence
  • learner can perform deny triage and manifest remediation
  • learner can apply a safe exception process without global bypass

Lab: Admission Guardrails in Audit and Enforce Modes (Advanced)

enable starter policies in Audit trigger and inspect violations switch one policy to Enforce validate deny -> fix -> admit behavior Prerequisites Kyverno engine running in cluster access to develop namespace …

Quiz: Chapter 15 (Admission Policy Guardrails)

What is the safest rollout order for new blocking policies? What does validationFailureAction: Audit do? What does validationFailureAction: Enforce do? Which statement is correct? A) If pre-commit passes, admission …

Runbook: Admission Policy Operations (Advanced)

Scope This runbook covers: policy engine health checks Audit and Enforce rollout operations deny triage and manifest remediation break-glass exception discipline Health and Inventory Checks kubectl -n kyverno get pods …