When to favor Initializers vs Mutating Webhooks

1/21/2019

I'd like to understand when it's better to favor a Custom Initializer Controller vs a Mutating Webhook.

From what I can gather, webhooks are:

  1. More powerful (can trigger on any action).
  2. More performant (only persist to etcd once).
  3. Easier to write (subjective, but production grade controllers aren’t trivial).
  4. Less likely to break during complete redeploy (there seems to be a chicken-and-egg problem requiring the deployment to exist before the initializer is in place, or the initializer will block the deployment).

When would I want an initializer instead? …or are they being abandoned in favor of webhooks?

-- Tammer Saleh
kubernetes

1 Answer

1/22/2019

Always favor webhooks. Initializers are unlikely to ever graduate from alpha, and will probably be removed as the apimachinery team dislikes the approach. They might remain in a few specialized cases like Namespaces, but not in general.

-- coderanger
Source: StackOverflow