How to run a script in a pod once, manually, using helm

5/14/2020

I'm looking for the correct way to run a one-time maintenance script on my Kubernetes cluster. I've got my deployment configured via Helm, so everything is bundled in my chart and works extremely well from an automation point of view.

Problem is running a script just once. I know Helm has hooks, but I don't think those can be configured to run manually (only pre/post upgrade/install etc.). This is compared to running kubectl apply -f my-maintenance-script.yaml, which I can do just once and be done with.

Is there a best-practice way of doing this? I want to be able to use Helm since I can feed all my config/template values into the Job.

-- LennyBorland
kubectl
kubernetes
kubernetes-helm

1 Answer

5/16/2020

You can use Kubernetes Job, and use helm test to run the Job.

-- C Han
Source: StackOverflow