There are two major components to implementing an Admission webhook controller: a webhook HTTP server to receive the resource life event and a ValidatingWebhookConfiguration or MutatingWebhookConfiguration resource configuration file. Please refer to https://github.com/PacktPublishing/DevOps-with-Kubernetes-Second-Edition/tree/master/chapter5/5-3_admission-webhook/sample-validating-admission-webhook for the source code of our sample Admission webhook.
Let's look at how to write a ValidatingWebhookConfiguration. As we can see in the following code, like normal objects, ValidatingWebhookConfiguration has an API version, a kind, and metadata with a name and labels. The important session is named webhooks. In webhooks, one ...