Helm Hook not triggered

3/19/2019

Context: Kubenete 1.0.3, Helm 2.8.2

Helm Hook: pre-install weight: 0 delete-policy: before-hook-creation

Helm command: helm upgrade --install -n namespace

Problem description: The hook block is well rendered when running with --dry-run mode. But after installing (without dry-run), no hook job is triggered.

Check the job using command kubectl get jobs -n namespace.

-- X.J
hook
kubernetes
kubernetes-helm

1 Answer

4/2/2019

Hook is a mechanism introduced in HELM to intervence at certain points in release life cycle. Hooks can be definied in few ways via special annotations in metadata section, i.e. "pre-install", "post-install", "pre-upgrade" etc. Example of the hook:

apiVersion: ...
kind: ....
metadata:
  annotations:
    "helm.sh/hook": "pre-install"

Full list of Hooks can be found here. In addition there can be used more than one hook.

In this case "pre-upgrade" option resolved the issue which was
"Executes on an upgrade request after templates are rendered, but before any resources are loaded into Kubernetes (e.g. before a Kubernetes apply operation)."

-- PjoterS
Source: StackOverflow