Interview Prep/DevSecOps/Kubernetes Security

What is the difference between mutating and validating admission webhooks?

IntermediateConceptKubernetes Security
Answer

Mutating webhooks change the object (inject sidecars, add default labels, set runAsNonRoot). Validating webhooks only accept or reject. Mutating runs first, then validating, so validators see the final object.

Security-relevant settings on the webhook configuration:

  • failurePolicy: Fail for security policy (fail closed), Ignore only for non-critical mutation.
  • namespaceSelector to exclude kube-system so a broken webhook cannot block the control plane.
  • timeoutSeconds short, because webhook latency adds to every API call.

A webhook outage with Fail can block deployments cluster-wide, so we run webhooks with multiple replicas and PDBs.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Kubernetes Security