Kubernetes namespace post and pre delete hooks

4/27/2020

Is there a way to trigger an external API whenever a Kubernetes namespace is getting deleted. Are there any post and pre hooks for namespace deletion/creation.

Or are there any way to handle it using any other Kubernetes resource except Pod

-- Ysak
automation
kubernetes
webhooks

1 Answer

4/27/2020

You can have a webhook to perform any task/operation that you want to do. When a a request to delete a namespace comes to kubernetes API server the webhook will be called by kubernetes API server automatically. A webhook is an http/https endpoint to a running piece of software which could be running in the Kubernetes cluster itself or somewhere else. A webhook need to be registered to Kubernetes API server to be able receive the request from the API server.

-- Arghya Sadhu
Source: StackOverflow