Skip to content

Webhooks

Your controllers can serve admission (validating, mutating) and CRD conversion webhooks.

Set the controller’s Webhook port (controller-runtime uses 9443). The controller then gets:

Service ctrl-<controller>-webhook, port 443 In your control plane’s namespace, forwarded to the webhook port.
/tmp/k8s-webhook-server/serving-certs/ A serving certificate, where controller-runtime looks; renewed automatically.

Use a service reference and leave caBundle empty: your control plane already trusts the certificate. You don’t need cert-manager.

clientConfig:
service:
namespace: acme # your control plane's namespace
name: ctrl-guestbook-webhook # ctrl-<controller>-webhook
path: /validate-webapp-example-com-v1-guestbook

Conversion webhooks use the same service in the CRD’s spec.conversion.webhook.clientConfig.

In config/, drop the certmanager directory, the cert-manager.io/inject-ca-from annotations and the webhook-service, and set the service name and namespace as above.

  • Webhooks may only match your own API groups, not "", * or groups ending in k8s.io or kubernetes.io.
  • With failurePolicy: Fail, matching requests fail while your controller isn’t running.