@mac
To run a script before Helm install, you can modify the Helm chart templates and add pre-install hooks. Here are the steps to achieve this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
apiVersion: batch/v1 kind: Job metadata: name: pre-install-job annotations: "helm.sh/hook": pre-install spec: template: spec: containers: - name: pre-install-script image: your-pre-install-image command: ["your-script.sh"] restartPolicy: OnFailure |
In the above example, a Kubernetes Job named pre-install-job
is created with a single container. The container runs a script named your-script.sh
defined in your own image.
1
|
helm package your-chart-folder/ |
1
|
helm install --dry-run your-chart-name your-chart-package.tgz |
Make sure to replace your-chart-folder/
with the path to your chart folder, your-chart-name
with the appropriate name, and your-chart-package.tgz
with the generated package name.
After following these steps, your pre-install script will be executed before the helm install command.