How to Helm upgrade only subchart

Viewed 2243

I have multiple subcharts under one helm chart. I install those using the command

helm install my-app . --values values.dev.yaml

It is working fine. All subcharts are part of a one release. Now I have requirements that other member will be starting working those individual subcharts and want to upgrade their subchart without deleting/upgrading the entire application's subchats and in the same release

so when for upgrading one one say frontend subchart from it. I tried

helm upgrade my-app ./charts/frontend --values values.dev.yaml.

It will terminate all the other pods and will keep only pod for this subchart frontend running. Is there any way to upgrade only subcharts of the application without touching the other subcharts?

2 Answers

Just run helm upgrade on the top-level chart normally

rm requirements.lock
helm dependency update
helm upgrade my-app . -f values.dev.yaml

This will "redeploy" the entire chart, including all of its subcharts, but Helm knows to not resubmit unchanged objects to Kubernetes, and Kubernetes knows to not take action when an unmodified object is submitted.

Helm subcharts have some limitations; in addition to what you describe here about not being able to separately manage subcharts' versions, they will also flatten recursive dependencies together (if A depends on B depends on Redis, and A depends on C depends on Redis, B and C will share a single Redis installation and could conflict). If you need to separately manage the versions, consider installing the charts as separate top-level releases.

If your sub-charts are 3rd party dependencies (i.e. you are combining some charts together in a single chart), you can update the external charts by updating Helm dependencies:

Once in the Helm chart dir, where Chart.yaml lives, run

$ helm dependency update

To make sure you get the latest dependency, update Helm repos first:

$ helm repo update && helm dependency update

This will download the latest dependent charts (or the latest allowed, depending on your Chart.yaml config.

Please Note that helm dependency update will download txz files. If no action is taken (i.e. ignore them in git), they could end up version-controlled in your git repo.

Related