I'd like to update a value config for a helm release on my cluster.

Something like

helm update -f new_values.yml nginx-controller


Solution 1:

helm upgrade -f ingress-controller/values.yml nginx-ingress stable/nginx-ingress

Or more generally:

helm upgrade -f new-values.yml {release name} {package name or path} --version {fixed-version}

The command above does the job.

Unless you manually specify the version with the --version {fixed-version} argument, upgrade will also update the chart version. You can find the current chart version with helm ls.

Docs: https://helm.sh/docs/helm/#helm-upgrade

Solution 2:

EDIT 2020-04-03:

--recreate-pods --wait is not recommended anymore. As Jorden pointed out one way is to add a checksum annotations that will implies to restart the pods if any file change. see https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments for reference doing so.

ORIGINAL ANSWER

To complement the answer of @stan-bondi, you can do :

helm upgrade --recreate-pods --wait -f new_values.yaml nginx-controller nginx-controller

This is often needed when you juste changed a configMap or secrets that wont be detected as a change in the release itself.

Solution 3:

This is how I update the current chart with new values, without upgrading the chart version:

helm upgrade --reuse-values -f values.yaml {release-name} {release-path} --version {fixed-version}

For example:

helm upgrade --reuse-values -f prometheus/values.yaml prometheus-operator stable/prometheus-operator --version 5.7.0 --namespace monitoring

I use a fixed version of the installed chart, and add --reuse-values flag to ensure that I keep the previous values I used.

Solution 4:

In the Deployment(or StatefulSet) yaml file, and if you are using ConfigMap or Secret you can add a checksum like below:

kind: Deployment
...
spec:
  template:
    metadata:
      annotations:
        checksum/config-env: {{ include (print $.Template.BasePath "/configmap-env.yaml") . | sha256sum }}

...

This will detect a changed in the configMap that wont be detected as a change in the release itself.