helm: Set a value using the CLI options

kubernetes helm chart dependency

1 min read | by Jordi Prats

Sometimes it comes handy to be able to set values using options instead of having to create a values files. Setting a value is quite trivial:

helm install argocd argo/argo-cd -n argocd --set 'server.ingress.enabled=true'

But how do we setup an array variable?

Setting an array it's just as easy, we just need to use curly brackets to tell helm that it is an array of values:

key={valueA,valueB}

Using this syntax we can set, for example server.ingress.hosts to a the list of strings argocd.127.0.0.1.nip.io and argocd-alias.127.0.0.1.nip.io:

helm install argocd argo/argo-cd -n argocd --set 'server.ingress.hosts={argocd.127.0.0.1.nip.io,argocd-alias.127.0.0.1.nip.io}'

We can even set multiple values using a single set option, just by separating key pairs by commas:

helm install argocd argo/argo-cd -n argocd --set 'server.ingress.enabled=true,server.ingress.hosts={argocd.127.0.0.1.nip.io,argocd-alias.127.0.0.1.nip.io}'

Posted on 02/01/2023

Categories