Admission Best Practices
Admission control is powerful enough to protect a cluster and powerful enough to break it. These practices keep your policies safe to roll out, easy to maintain, and versioned alongside the clusters they run on.
Busca en todas las páginas de la documentación
Admission control is powerful enough to protect a cluster and powerful enough to break it. These practices keep your policies safe to roll out, easy to maintain, and versioned alongside the clusters they run on.
Read each group in order; the early groups reduce blast radius, the later ones cover authoring and operations.
Treat every practice as a default you deviate from only with a reason. Apply them incrementally, starting with the safety-scoping group before you enforce anything.
Audit, Gatekeeper's dryrun, or a CEL binding's Warn/Audit action first, and only promote to enforcement once reports are clean.PolicyReport, Gatekeeper status.violations) to see how many existing workloads would fail before you block anything.kube-system, kube-node-lease, and the policy engine's own namespace to excludedNamespaces or a namespaceSelector so a policy outage cannot wedge the control plane.Fail is stronger for security but blocks writes when the webhook is down; Ignore favors availability. Decide based on what the rule protects.timeoutSeconds to 5-10 so a slow endpoint does not stall every write; admission runs synchronously in the request path.apiGroups, resources, and operations you need, and use objectSelector to skip objects that should never be gated.ValidatingAdmissionPolicy for simple checks, and reserve Kyverno or Gatekeeper for logic they cannot express.reinvocationPolicy: IfNeeded when a rule must see the final object.:latest, required probes, allowed registries) instead of hand-writing them.conftest, kyverno test, or gator test against the output of helm template and kubectl kustomize, not the source templates.kubectl apply --dry-run=server for exact parity.conftest verify and engine test files so a broken policy that silently allows everything is caught in CI.You should have a policy set that begins in audit, excludes control-plane namespaces, and enforces only after reports are clean.
Your rules should live in Git, deploy through GitOps, run in CI against rendered manifests, and carry a version that moves with each cluster upgrade.
If a policy engine outage cannot block your control plane and a developer can read any rejection message and fix it unaided, the guardrails are production-ready.
Should every policy start in audit mode? Yes. Enforcing a new rule cold risks blocking legitimate workloads; audit first, review reports, then promote to deny.
How do I keep policies from breaking on upgrades? Version them with the cluster and test against each new Kubernetes minor, because Pod Security defaults, CEL, and API fields evolve.
Which engine should I standardize on? Use the simplest that expresses your rules: Pod Security Admission or CEL for basics, Kyverno for YAML-native teams, Gatekeeper for a central Rego library.
What is the single most important safety setting? Excluding control-plane and engine namespaces from enforcing webhooks, so an engine outage cannot lock you out.
Where should policies live? In Git, deployed via Argo CD or Flux, so every change is reviewed and reversible like any other manifest.
How do I stop CI from drifting from the cluster? Share the same policy source or add a server-side dry-run gate against a cluster that mirrors production policy configuration.
Stack versions: This page was written for Kubernetes 1.36.2, Docker Engine 29.6.1 (BuildKit default), containerd (CRI runtime on nodes), Helm 3, Compose v2, Argo CD (latest - verify at build), and Gateway API (GA - verify controller support at build).
Revisado por Chris St. John·Última actualización: 16 jul 2026