Deleting webhooks from a cluster
Some troubleshooting and debugging steps might require you to temporarily remove certain webhooks from your cluster. Follow these steps to remove webhooks, then reapply them after you have resolved your issue.
-
List the mutating webhooks in your cluster.
kubectl get mutatingwebhookconfigurations
-
For each mutating webhook, copy the component YAML file and delete the webhook.
-
Run the command to copy the YAML file. Save the YAML file so you can reapply it later.
kubectl get mutatingwebhookconfigurations <WEBHOOK-NAME> -o yaml > <WEBHOOK-NAME>.yml
-
Delete the mutating webhook.
kubectl delete mutatingwebhookconfigurations <WEBHOOK-NAME>
-
-
List the validating webhooks in your cluster.
kubectl get validatingwebhookconfigurations
-
Identify any validating webhooks that are not included in the following list.
alertmanagerconfigs.openshift.io
managed-storage-validation-webhooks
multus.openshift.io
performance-addon-operator
prometheusrules.openshift.io
snapshot.storage.k8s.io
Any validating webhook that is included in this list should not be deleted in the following steps.
-
For each validating webhook that is not included in the previous list, copy the component YAML file and delete the webhook.
-
Run the command to copy the YAML file. Save the YAML file so you can reapply it later.
kubectl get validatingwebhookconfigurations <WEBHOOK-NAME> -o yaml > <WEBHOOK-NAME>.yml
-
Delete the validating webhook.
kubectl delete validatingwebhookconfigurations <WEBHOOK-NAME>
-
-
When you are done troubleshooting your worker node issue, reapply the webhook YAML files.
kubectl apply -f <webhook-yaml-file>