Home > Net >  K8s helm change one specific value after install without using values.yaml file
K8s helm change one specific value after install without using values.yaml file

Time:06-20

In k8s - I have an helm chart already installed and running deployments.

After the installation, I want to change only one specific value of the helm chart, that reflects some of k8s yaml files (templates using helm).

I don't have the helm values file, but need to use the same values, and change only one value for the chart.

Can I upgrade helm chart, by changing only one value.

helm upgrade takes chart name and folder of yaml file, but I don't want any use for yaml file.

CodePudding user response:

You can use the --set key=value to override a single value and that switch can be used multiple times to set multiple values (although you need to be aware of some escaping shenanigans such as with "." characters)

Anything you don't override by the use of a --set or --values switch will fall back to the values.yaml embedded within the chart.

But this also comes with a caveat. Some charts deliberately do not embed a values.yaml file, opting for profiles such that an install must explicitly declare which one to use or the chart will fail to install. Such an example I discussed in this answer

The safest way to update a chart with only a single value is to dump the values of the release using

helm get values -n {namespace} {release} > values.yaml

Then install using those values and override with your single override.

helm get values -n {namespace} {release} repo/chart-name \
  --values values.yaml \
  --set override-key=override-value

This guarantees the same values are provided that are currently being used in the chart, without needing to know the profile(s) used originally.

  • Related