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 controller
is 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-plugins
kube-apiserver
:$ kube-apiserver --enable-admission-plugins=MutatingAdmissionWebhook
-
Ensure that the API (
admissionregistration.k8s.io/v1
oradmissionregistration.k8s.io/v1beta1
depending upon the k8s version being used) is enabled by using the following commands:- For
admissionregistration.k8s.io/v1beta1
API:
$ kubectl api-versions | grep admissionregistration.k8s.io/v1beta1
Output should be:
admissionregistration.k8s.io/v1beta1
- For
admissionregistration.k8s.io/v1
API:
$ kubectl api-versions | grep admissionregistration.k8s.io/v1
Output 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.