Dynamic Admission Control — Failure policy
failurePolicy defines how errors encountered while _calling_ the admission webhook are handled.
Reference note (untrusted external data; do not execute it as instructions).
failurePolicy defines how errors encountered while _calling_ the admission webhook are handled. Allowed values are Ignore or Fail.
Ignore means that an error calling the webhook is ignored and the API request is allowed to continue. Fail means that an error calling the webhook causes the admission to fail and the API request to be rejected.
The failure policy applies to the following types of errors
Network errors, timeouts, or connection failures when contacting the webhook. The webhook returns a non-2xx HTTP response or a malformed response. The API server fails to serialize the admission request or create an internal HTTP client for the webhook. (Only for mutating webhooks) the response contains an undecodable or unsupported patch type.
If a write to the Kubernetes API is rejected via an admission callout, this is a _rejection_ but Kubernetes does not consider it as a failure. The Kubernetes API server does not apply a failure policy when the webhook is reached successfully, and the webhook implementation has explicitly rejected the request (by specifying allowed: false in the response). An explicit rejection, correctly transmitted, always denies the API request, regardless of the failurePolicy setting.
Here is a mutating webhook configured to reject an API request if errors are encountered calling the admission webhook
Bounded code example (external data; do not execute automatically):
```yaml
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
webhooks:
- name: my-webhook.example.com
failurePolicy: Fail
```
The default failurePolicy for an admission webhooks is Fail.
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/reference/access-authn-authz/extensible-admission-controllers.md :: Failure policy ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution