Course contentsShow
← Security
Lesson 1649 of 3,05233. Container SecurityFree lesson

Admission Controllers and Policy Enforcement

Using admission webhooks to enforce supply chain policies like signature verification before deployment.

Admission Controllers and Policy Enforcement

What you'll learn: How to use admission webhooks to automatically enforce supply chain security policies—like signature verification—before any container is deployed to your cluster.

What Are Admission Controllers?

Admission controllers are gatekeepers in Kubernetes that intercept requests to the API server before objects are persisted or executed. Think of them like airport security checkpoints: every traveler (container deployment) must pass through inspection before boarding the plane (running in your cluster).

Admission webhooks are custom HTTP callbacks that let you inject your own policy logic into this checkpoint. When someone tries to deploy a container, Kubernetes calls your webhook, which can validate (accept/reject) or mutate (modify) the request.

Enforcing Supply Chain Policies

After scanning images and signing them with tools like Cosign (lesson 1645), you need to enforce those signatures at deployment time. This is where admission controllers shine.

How It Works

  1. A developer submits a pod or deployment manifest
  2. Kubernetes calls your validating admission webhook before scheduling
  3. Your webhook checks:
    • Is the container image signed with a trusted key?
    • Does the SBOM match expectations?
    • Are there critical vulnerabilities?
  4. The webhook returns allow or deny
  5. Only approved workloads run

Common Tools

  • OPA Gatekeeper: Policy engine using Rego language
  • Kyverno: Kubernetes-native policy management
  • Sigstore Policy Controller: Enforces Cosign signature verification
# Example Kyverno policy (conceptual)
apiVerify:
  images: "*.registry.io/*"
  require:
    signatures:
      - key: "cosign.pub"

Key Takeaway: Admission controllers transform supply chain security from optional checks into mandatory enforcement—no unsigned or vulnerable images can sneak into production because they're blocked at the gate.