73

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

Stan Bondi
  • 4,118
  • 3
  • 24
  • 35

6 Answers6

104
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/

mjarosie
  • 3,228
  • 2
  • 20
  • 31
Stan Bondi
  • 4,118
  • 3
  • 24
  • 35
  • Can you include new keys in the `new-values.yml` file that aren't in the original chart? I'm trying to add a pod `antiAffinity` block to pods in an existing (not mine) chart. – jkmacc Dec 07 '18 at 23:39
  • `➜ helm list -A NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION my-prometheus-operator default 1 2020-07-07 20:31:28.019196 +0530 IST deployed prometheus-operator-8.15.11 0.38.1 vvp vvp 1 2020-07-08 14:30:30.330573 +0530 IST deployed ververica-platform-4.1.1 2.1.1 ➜ helm upgrade -f values-min.yaml vvp ververica-platform-4.1.1 Error: failed to download "ververica-platform-4.1.1" (hint: running helm repo update may help)` Still I am not able to upgrade – Tinkaal Gogoi Jul 08 '20 at 09:30
  • Note that in case of updating values of the nginx ingress controller and if one has additional configuration options specified via the ConfigMap, the content of the ConfigMap will get emptied when doing a `helm upgrade`. Recreate the ConfigMap afterwards. – alvarez Feb 04 '21 at 08:47
21

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.

webofmars
  • 1,439
  • 1
  • 18
  • 25
  • About --recreate-pods, it seems this is no longer recommended. See here for an alternative: https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments – Jørgen Tvedt Apr 03 '20 at 05:19
  • 1
    Totally true @JørgenTvedt this answer was designed for helm 2 and it a bit outdated. I will update it. – webofmars Apr 03 '20 at 07:45
  • @webofmars How's that done (concerning your edit) I installed the chart with helm install. But I just cannot figure out how to change the deployment in the way it is described at the link you provided. Could you please elaborate on that? Thank you – AndyB Apr 22 '20 at 12:40
  • @AndyB You can just copy paste the given exemple: ``` kind: Deployment spec: template: metadata: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} ``` Just point the exemple of configmap.yaml to something that is likely to change at each deployment :-) – webofmars Apr 22 '20 at 16:06
  • @webofmars Thank you. But question is: where: I am completely new to helm, if I just do an install, I don't have access to the deployment.yaml? At least I did not find out how, after hours of searching. The answer is probably totally easy, but I might oversee something here. It's a chart from the bitnami team, which I used directly. We need a zero downtime solution – AndyB Apr 23 '20 at 05:13
  • @AndyB I would consider to open a PR on the public chart offered by bitnani. Also many charts offers to surcharge the annotations of the deployments so i guess you can do that in a local copy of the values.yaml you pass to -f – webofmars Apr 23 '20 at 09:59
18

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.

Yair Cohen
  • 417
  • 4
  • 16
3

I just changed install to upgrade and that worked for me.

helm upgrade \
  airflow \
  airflow-stable/airflow \
  --version 7.16.0 \
  --namespace airflow \
  --values airflow.config.yaml

If it's still giving you trouble after this, you can recycle all the pods in the namespace like so

kubectl delete pods -n airflow --all
jmcgrath207
  • 1,317
  • 2
  • 19
  • 31
2

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.

alltej
  • 6,787
  • 10
  • 46
  • 87
1

You can do:

helm upgrade -f new_values.yaml nginx-controller nginx-controller

This will update the revision of your chart which can be viewed using:

helm ls

or more specifically:

helm get nginx-controller

For helm chart upgrades, check this link from the docs: https://docs.helm.sh/helm/#helm-upgrade

Basith
  • 831
  • 1
  • 7
  • 14
  • 2
    Ah ha, so maybe can update the answer - my problem was in all the examples for helm they use `helm upgrade -f ingress-controller/helm-values.yml nginx-ingress ./some/path` but you can use remote helm package name in the last argument like so `helm upgrade -f ingress-controller/helm-values.yml nginx-ingress stable/nginx-ingress` and that will upgrade to the latest chart too. What if I just want to update the values and have helm recompile the templates and apply them? – Stan Bondi Feb 23 '18 at 08:25