Lion Cipher Lab

Enforce Kubernetes policy at admission with OPA Gatekeeper

Why it matters

Scanning manifests in CI catches bad config early, but it's advisory — anyone with cluster access can `kubectl apply` around it. Admission control is the hard gate: a policy that runs inside the API server's request path, so a Pod without the required labels, a container running as root, or a namespace missing an owner tag never enters the cluster at all. Gatekeeper is the OPA-based way to do that, and knowing how to author, test, and safely roll out an admission policy — including the audit-first path onto an already-messy cluster and the webhook-reliability footgun — is core cloud-security…

What you'll learn

Steps in this lab

  1. What admission control is, and where Gatekeeper sits
  2. Spin up a disposable kind cluster (and pin the node version)
  3. Install Gatekeeper
  4. Write the ConstraintTemplate (this is where the Rego lives)
  5. Create the Constraint and prove the deny
  6. The enforcementAction knob, and auditing what's already there
  7. Pick the right tool — and respect the webhook footgun

Open the full interactive lab →