Helm using different values.yaml without CDing into deployment directory

8/27/2021

I have my values.yaml in my_project_directory under deployment as below

C:\Users\Username\IdeaProjects\my-project\deployment\values.yaml

I need to use different values.yaml based on certain triggers in AzureDevops.

Current way I am running is (This runs fine and uses values.yaml)

helm install my-app-name ./deployment/ --namespace=my-namespace-name

I have two other values.yaml as below

C:\Users\Username\IdeaProjects\my-project\deployment\values_dev.yaml
C:\Users\Username\IdeaProjects\my-project\deployment\values_preprod.yaml

and can run using respective commands

helm install my-app-name . -f values_dev.yaml --namespace=my-namespace-name
helm install my-app-name . -f values_preprod.yaml --namespace=my-namespace-name

These work fine but I have to cd into deployment and run these. Anyway I can run it from project root directory?

Tried this

helm install my-app-name -f ./deployment/values_dev.yaml --namespace=my-namespace-name

Got this error

Error: must either provide a name or specify --generate-name

Also tried this

 helm install my-app-name -f ./deployment/values_dev.yaml --namespace=my-namespace-name --generate-name

Got this error

Error: failed to download "my-app-name" (hint: running `helm repo update` may help)

Also tried this

helm install my-app-name ./deployment/values_dev.yaml --namespace=my-namespace-name

Got this error

Error: file 'C:\Users\User\IdeaProjects\my-project\deployment\values_dev.yaml' seems to be a YAML file, but expected a gzipped archive
-- Venkatesh Gotimukul
azure-aks
helm3
kubernetes
kubernetes-helm
yaml

2 Answers

8/28/2021

run from the project root directory =

helm install my-app-name . -f deployment/values_dev.yaml --namespace=my-namespace-name

-- Philip Welz
Source: StackOverflow

8/29/2021

These commands worked for me to use different values.yaml from the root folder (All these 3 values files are under deployment folder)

helm install my-app-name ./deployment/ --values ./deployment/values.yaml --namespace=my-namespace-name

helm install my-app-name ./deployment/ --values ./deployment/values_dev.yaml --namespace=my-namespace-name

helm install my-app-name ./deployment/ --values ./deployment/values_preprod.yaml --namespace=my-namespace-name
-- Venkatesh Gotimukul
Source: StackOverflow