Middle
How do you perform chart updates in Helm?
sobes.tech AI
Answer from AI
Updating charts in Helm is performed with the command helm upgrade.
Main flags used during the upgrade:
--install: If a release with the specified name does not exist, Helm will install it. Convenient for idempotency.--version <chart_version>: Specifies a particular chart version for the upgrade. If not specified, the latest stable version is used.--values <values_file>: Overrides default values invalues.yamlusing the specified file. Can be used multiple times.--set <key=value>: Overrides default values directly in the command line. Useful for small changes.--namespace <namespace>: Specifies the namespace where the release is located.--atomic: Rolls back the upgrade if it fails (e.g., due to deployment issues).--wait: Waits until all release resources are ready before declaring success.
Example usage:
# Upgrade the release 'my-release' in the 'default' namespace
# using a new chart version './mychart'
# and overriding 'image.tag' from 'values.yaml'
helm upgrade my-release ./mychart --namespace default --values values.yaml --set image.tag=latest
The upgrade process includes:
- Helm downloads the specified chart version.
- Applies overridden values (from
--valuesfiles and--setflags). - Generates Kubernetes manifests based on chart templates and final values.
- Sends these manifests to the Kubernetes API server.
- Kubernetes performs a rolling update for deployed resources (e.g., Deployment).
- When using
--atomic, if deployment fails, Helm automatically rolls back to the previous working release version.
Helm keeps a history of all releases, allowing rollbacks with the helm rollback command.