K8s Gatekeeper Troubleshooting logo

K8s Gatekeeper Troubleshooting

Organization
k8s-servant
k8s-gatekeeper-troubleshooting

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.

Overview

Publisherk8s-servant
Repositoryk8s-skills
Skill namek8s-gatekeeper-troubleshooting
Stars
36
Forks
7
Bundled files
3
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by k8s-servant on GitHub. Read the source before you install it.

Installation

Install the K8s Gatekeeper Troubleshooting AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-gatekeeper-troubleshooting
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/k8s-servant/k8s-skills.git /tmp/k8s-skills
mkdir -p .claude/skills
cp -r /tmp/k8s-skills/skills/k8s-gatekeeper-troubleshooting .claude/skills/k8s-gatekeeper-troubleshooting
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable K8s Gatekeeper Troubleshooting in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads K8s Gatekeeper Troubleshooting on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so K8s Gatekeeper Troubleshooting is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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 Secrets.

When to use

  • A request is denied by validation.gatekeeper.sh, or prints a Gatekeeper warning.
  • A constraint does not block what it should, or lists violations in its status.
  • Applying a constraint fails because its kind does not exist.
  • A policy that looks at other objects (unique hostnames, namespaces) never fires.
  • Gatekeeper mutations do not change resources.

Hand-offs, by skill name. When the evidence points elsewhere, continue with that skill; if it is not installed, keep going with the steps here and tell the user which skill would help:

  • The Gatekeeper pods crash or stay Pending: k8s-workload-troubleshooting.
  • The denial comes from Kyverno (validate.kyverno.svc-fail, vpol.validate.kyverno): k8s-kyverno-troubleshooting.

Investigate

Work through the steps in order. Stop when you have the cause and its evidence.

1. Read the denial or warning. The text in square brackets is the constraint's name: admission webhook "validation.gatekeeper.sh" denied the request: [<constraint>] <message>. A warning reads Warning: [<constraint>] <message>.

2. List templates and constraints. Every constraint kind is its own resource; constraints lists them all.

bash
kubectl get constrainttemplates
kubectl get constraints

3. Read the constraint: what it matches, its action, its parameters, and the audit's violations.

bash
kubectl get k8srequiredlabels my-constraint -o yaml
kubectl get k8srequiredlabels my-constraint -o jsonpath='{.spec.enforcementAction}{"\n"}{.spec.match}{"\n"}{.spec.parameters}{"\n"}{.status.totalViolations}{"\n"}{.status.violations}{"\n"}'

4. Read the template's status: whether it compiled on every Gatekeeper pod.

bash
kubectl get constrainttemplate k8srequiredlabels -o jsonpath='{.status.created}{"\n"}{range .status.byPod[*]}{.id}{" "}{.errors}{"\n"}{end}'
kubectl get crds | grep constraints.gatekeeper.sh

5. If Gatekeeper itself may be the problem, read its pods, webhooks, Config and logs.

bash
kubectl get deployments,pods -n gatekeeper-system
kubectl get validatingwebhookconfiguration gatekeeper-validating-webhook-configuration -o jsonpath='{range .webhooks[*]}{.name}{" "}{.failurePolicy}{"\n"}{end}'
kubectl get configs.config.gatekeeper.sh -n gatekeeper-system -o yaml
kubectl get namespace my-namespace --show-labels
kubectl logs -n gatekeeper-system deployment/gatekeeper-controller-manager -c manager --tail=100
kubectl logs -n gatekeeper-system deployment/gatekeeper-audit -c manager --tail=100

6. Open the matching reference and follow its steps:

What you seeReference
A denial or warning, violations in a constraint's status, a constraint that does not block (dryrun, warn, scoped, match)references/constraints.md
A template that does not compile, no matches for kind, ValidatingAdmissionPolicies Gatekeeper generatesreferences/templates.md
Gatekeeper stopped enforcing, webhook down, exempt namespaces, sync for referential policies, mutationreferences/webhook-sync-mutation.md

Read the results

What the common findings mean (Gatekeeper 3.23):

  • denied the request: [<constraint>] <message>: the constraint has enforcementAction: deny (the default) and the resource violates it. The message is the template's own text.
  • Violations in status.violations but nothing blocked: the constraint is dryrun (audit only) or warn, or the resource existed before the constraint (the webhook checks only new requests; the audit finds the rest). status.violations holds at most 20 entries by default; totalViolations is the full count.
  • A template with byPod[].errors such as ingest_error Could not ingest Rego: ... rego_parse_error: the policy code does not compile. Gatekeeper accepts the template object but never creates its constraint kind.
  • no matches for kind "<Kind>" in version "constraints.gatekeeper.sh/v1beta1" or the server could not find the requested resource when applying a constraint: the kind does not exist yet, because its template is missing or failed to compile.
  • Nothing enforced, yet the constraint is right: the Gatekeeper webhook pods are down. validation.gatekeeper.sh uses failurePolicy: Ignore, so the API server admits everything while Gatekeeper is unreachable, and only the audit notices.
  • A namespace never checked: it carries the label admission.gatekeeper.sh/ignore, is listed in the Config's excludedNamespaces, or the constraint's match leaves it out. gatekeeper-system is always exempt.

State the cause in one sentence, then the evidence you saw (the denial or violation, the constraint and its action, the template status), then the proposed fix.

Proposed fix

Show each fix to the user before running it: what it changes and how to undo it. Make the resource comply in its source (manifest, Helm values, GitOps repository). Changing a constraint's action or match, fixing a template, exempting a namespace and editing Gatekeeper's Config or webhooks change what is enforced for everyone: never run them yourself; hand them to the constraint's owners as proposed fixes. Write each undo with the values you found.

Bring back Gatekeeper's webhook after it was scaled to zero (write the undo with the replicas you found):

Ask first: the agent runs this only after the user approves it.

bash
kubectl scale deployment/gatekeeper-controller-manager -n gatekeeper-system --replicas=3
# Undo: kubectl scale deployment/gatekeeper-controller-manager -n gatekeeper-system --replicas=0

Resources admitted while the webhook was down stay as they are; the audit lists them in the constraints' status.violations, and they are fixed in their source.

Sources

Checked against the Gatekeeper 3.23 documentation and source (v3.23.1):

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the K8s Gatekeeper Troubleshooting AI skill do?

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, desc...

Why use K8s Gatekeeper Troubleshooting on TypingMind?

Because you install it once and use it with any model. K8s Gatekeeper Troubleshooting is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install K8s Gatekeeper Troubleshooting in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-gatekeeper-troubleshooting. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use K8s Gatekeeper Troubleshooting?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with K8s Gatekeeper Troubleshooting?

As many as you like. As long as a model supports skills, you can use K8s Gatekeeper Troubleshooting with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the K8s Gatekeeper Troubleshooting AI skill free?

Yes. It is published on GitHub by k8s-servant under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇