Prerequisites
- Ensure that Kubernetes cluster is at least as new as v1.16 ( to use
admissionregistration.k8s.io/v1) or v1.9 ( to useadmissionregistration.k8s.io/v1beta1)
- Ensure that
MutatingAdmissionWebhook admission controlleris enabled. You can check if it is enabled by looking at the admission plugins that are enabled by running the following command inkube-apiserver:If not enabled, then you can enable this plugin by running the following command in$ kube-apiserver -h | grep enable-admission-pluginskube-apiserver:$ kube-apiserver --enable-admission-plugins=MutatingAdmissionWebhook
-
Ensure that the API (
admissionregistration.k8s.io/v1oradmissionregistration.k8s.io/v1beta1depending upon the k8s version being used) is enabled by using the following commands:- For
admissionregistration.k8s.io/v1beta1API:
$ kubectl api-versions | grep admissionregistration.k8s.io/v1beta1Output should be:
admissionregistration.k8s.io/v1beta1- For
admissionregistration.k8s.io/v1API:
$ kubectl api-versions | grep admissionregistration.k8s.io/v1Output should be:
admissionregistration.k8s.io/v1 - For
- TLS Certificate Requirement:
In Kubernetes, in order for the API server to communicate with the webhook component, the webhook requires a TLS certificate that the API server is configured to trust. You can refer to the deployment section to understand more about it.