← ClaudeAtlas

k8s-gatekeeper-troubleshootinglisted

Use when OPA Gatekeeper blocks, warns about or fails to police resources in Kubernetes: "admission webhook \"validation.gatekeeper.sh\" denied the request: [constraint] message", warnings from constraints in warn mode, a constraint that should block but only shows violations in audit (dryrun), a ConstraintTemplate that does not compile (ingest_error, rego_parse_error), "no matches for kind" when applying a constraint, referential policies that never fire (sync), mutations that do not apply, or Gatekeeper that stopped enforcing because its webhook is down. Investigates with kubectl get, describe and logs, and proposes fixes. Reads first and asks before changing anything.
k8s-servant/k8s-skills · ★ 37 · DevOps & Infrastructure · score 83
Install: claude install-skill k8s-servant/k8s-skills
# OPA Gatekeeper troubleshooting Find out why Gatekeeper denies, warns about or does not police a resource, and propose a fix. **Read first, ask before changing.** Run the investigation commands freely. Run a command under an "Ask first" line only after the user approves that exact command; if your credentials do not allow it, give it to the user to run. Never run a "Proposed fix"; hand it to the user. A **ConstraintTemplate** holds the policy code (Rego, or CEL under `K8sNativeValidation`) and makes Gatekeeper create a new kind in `constraints.gatekeeper.sh` (for example `K8sRequiredLabels`). A **constraint** of that kind says where the policy applies (`spec.match`), with which parameters, and what happens on a violation (`spec.enforcementAction`: `deny`, `dryrun`, `warn` or `scoped`). The admission webhook checks new requests; the **audit** checks what already exists and writes the results into each constraint's status. A constraint is a guardrail someone chose on purpose. The usual fix is to make the resource comply; changing, scoping or exempting a constraint is a decision for its owners. The commands use placeholders: `my-namespace`, `my-app`, `k8srequiredlabels` (a template) and `my-constraint` (a constraint of kind `K8sRequiredLabels`). Replace them with the real names. The built-in `view` role cannot read Gatekeeper's objects (Gatekeeper adds nothing to it); if the commands are forbidden, say so and ask the user for the constraint and template status. Never read S