Logo: K8s Gatekeeper Troubleshooting

K8s Gatekeeper Troubleshooting

Organisatioun
k8s-servant
k8s-gatekeeper-troubleshooting

Sinn dës Skill, wann OPA Gatekeeper Ressourcen op Kubernetes blockéiert, Warnunge weist oder net iwwerwaacht: "admission webhook \"validation.gatekeeper.sh\" denied the request: [constraint] message", Warnunge vu Constraints am Warnmodus, e Constraint, deen eigentlech blockéiere soll, awer nëmme Verstéiss am Audit (dryrun) weist, e ConstraintTemplate, deen net kompiléiert (ingest_error, rego_parse_error), "no matches for kind" beim Applizéiere vun engem Constraint, referenziell Policies, déi ni ausgeléist ginn (sync), Mutatiounen, déi net applizéiert ginn, oder Gatekeeper, deen net méi iwwerwaacht, well säi Webhook net leeft. Ënnersicht de Problem mat kubectl get, describe a Logs a schléit Léisunge vir. Liest als éischt a freet, éier eppes geännert gëtt.

Iwwersiicht

Editeurk8s-servant
Repositoryk8s-skills
Skill-Nummk8s-gatekeeper-troubleshooting
Stären
36
Forks
7
Matgeliwwert Dateien
3
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 3 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    k8s-servant huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill K8s Gatekeeper Troubleshooting an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-gatekeeper-troubleshooting
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert K8s Gatekeeper Troubleshooting an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet K8s Gatekeeper Troubleshooting automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass K8s Gatekeeper Troubleshooting net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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):

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill K8s Gatekeeper Troubleshooting?

Sinn dës Skill, wann OPA Gatekeeper Ressourcen op Kubernetes blockéiert, Warnunge weist oder net iwwerwaacht: "admission webhook \"validation.gatekeeper.sh\" denied the request: [constraint] message", Warnunge vu Constraints am Warnmodus, e Constraint, deen eigentlech blockéiere soll, awer nëmme Verstéiss am Audit (dryrun) weist, e ConstraintTemplate, deen net kompiléiert (ingest_error, rego_parse_error), "no matches for kind" beim Applizéiere vun engem Constraint, referenziell Policies, déi ni ausgeléist ginn (sync), Mutatiounen, déi net applizéiert ginn, oder Gatekeeper, deen net méi iwwe...

Firwat K8s Gatekeeper Troubleshooting op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. K8s Gatekeeper Troubleshooting besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech K8s Gatekeeper Troubleshooting an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/k8s-servant/k8s-skills/tree/main/skills/k8s-gatekeeper-troubleshooting an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen K8s Gatekeeper Troubleshooting benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat K8s Gatekeeper Troubleshooting benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir K8s Gatekeeper Troubleshooting domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill K8s Gatekeeper Troubleshooting gratis?

Jo. k8s-servant huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇