Hooks
Helm provides a hook mechanism to allow chart developers to interveneat certain points in a release’s life cycle. For example, you can usehooks to:
- Load a ConfigMap or Secret during install before any other charts areloaded.
- Execute a Job to back up a database before installing a new chart,and then execute a second job after the upgrade in order to restoredata.
- Run a Job before deleting a release to gracefully take a service outof rotation before removing it.
Hooks work like regular templates, but they have special annotationsthat cause Helm to utilize them differently. In this section, we coverthe basic usage pattern for hooks.
Hooks are declared as an annotation in the metadata section of a manifest:
apiVersion: ...
kind: ....
metadata:
annotations:
"helm.sh/hook": "pre-install"
# ...