Admission controller
Kubernetes API server code or webhook that inspects, and can mutate or reject, every create or update request after authentication and authorisation.
Every write to the Kubernetes API passes authentication, then RBAC authorisation, then admission. Mutating admission runs first (inject sidecars, set defaults), then validating admission (reject a privileged pod, an unsigned image, a missing label). Admission is the last point where policy can stop an object before it is persisted to etcd.
Built-in controllers include Pod Security Admission and ResourceQuota. Custom policy runs as a ValidatingWebhookConfiguration or MutatingWebhookConfiguration pointing at a service such as OPA Gatekeeper or Kyverno, or in-process as a ValidatingAdmissionPolicy written in CEL (GA in Kubernetes 1.30), which avoids a network hop.
The hard part is availability. failurePolicy: Fail means a broken webhook blocks every deploy, including the fix; Ignore means an attacker who can crash the webhook bypasses policy. Production designs run several replicas, exclude kube-system via namespaceSelector, set tight timeouts and roll out new rules in audit or warn mode first.
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: image-signature-policy
webhooks:
- name: verify.images.example.com
rules:
- apiGroups: [""]
apiVersions: ["v1"]
operations: ["CREATE", "UPDATE"]
resources: ["pods"]
clientConfig:
service: { namespace: policy, name: verifier, path: /validate }
failurePolicy: Fail
timeoutSeconds: 5
sideEffects: None
admissionReviewVersions: ["v1"]
namespaceSelector:
matchExpressions:
- { key: kubernetes.io/metadata.name, operator: NotIn, values: ["kube-system"] }