How to make Helm install to use 'kubectl apply' instead of 'kubectl create'

Viewed 1379

When we run helm install ./ --name release1 --namespace namespace1, it creates the chart only if none of the deployments exist then it fails saying that the deployment or secret or any other objects already exist.

I want the functionality to create Kubernetes deployment or objects as part of helm install only those objects or deployments already not exists if exists helm should apply the templates instead of creating.

I have already tried 'helm install' by having a secret and the same secret is also there in the helm templates, so helm installs fail.

2 Answers

In recent helm versions you can run helm upgrade --install which does an upgrade-or-install.

Another alternative is you can use helm template to generate a template and pipe it to kubectl apply -f -. This way you can install or upgrade with the same command.

Related