<p>I'm using a <code>MutatingWebhookConfiguration</code> in order to inject a sidecar app into my pod. This works fine, but I'd like now to be able to create a new service for this sidecar. Anyway my question is a bit broader: can we from a webhook create other objects or are we limited to mutate only the request object ? </p>

<p>Do you have any solution ?</p>

benjamin.d
<p>Kubernetes doesn't have such a mechanism: Mutating Webhooks for an outside object or manifest. </p>

<p>In essence, you can concatenate as many objects/manifests in a <a href="https://kubernetes.io/docs/user-journeys/users/application-developer/foundational/#section-2" rel="nofollow noreferrer">Kubernetes config file</a>. So, you could have a manifest that injects the sidecar component together with the creation of a service.  You can separate the manifests using a <code>---</code> line, which signals the start of a new <a href="https://stackoverflow.com/a/50788318/2989261">document</a> in YAML. Then apply the whole configuration files with:</p>

<pre><code>$ kubectl apply -f &lt;config-file&gt;.yaml
</code></pre>

<p>More background on <a href="https://stackoverflow.com/a/55132302/2989261">this answer</a>.</p>
