69

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

6 Answers 6

101
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

3
  • 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 7, 2018 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 Jul 8, 2020 at 9: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 4, 2021 at 8: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.

6
  • About --recreate-pods, it seems this is no longer recommended. See here for an alternative: helm.sh/docs/howto/charts_tips_and_tricks/… Apr 3, 2020 at 5:19
  • 1
    Totally true @JørgenTvedt this answer was designed for helm 2 and it a bit outdated. I will update it.
    – webofmars
    Apr 3, 2020 at 7: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, 2020 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, 2020 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, 2020 at 5:13
17

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.

1
  • thanks! it didn't trigger the new deployment so pod stayed with same values
    – confiq
    Jun 12, 2020 at 11:23
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
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.

2
  • Dumb question, but do I edit the yaml within K8s dashboard or locally and then apply it with kubectl or helm? Or something else?
    – Noah
    Mar 29, 2020 at 10:14
  • Locally and then kubectl apply
    – alltej
    Mar 29, 2020 at 12:00
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

1
  • 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, 2018 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.