Sub topic 12
Packaging and publishing charts
This chapter assumes you can scaffold a chart, read Chart.yaml, and run helm install against a cluster. It also assumes you have seen the dependencies block. Here you will turn a chart directory into a versioned archive and share it through an OCI registry or an HTTP repository.
What packaging produces
A chart directory is good for development. To share a chart you package it. helm package creates a compressed archive named <name>-<version>.tgz. The name and version come from Chart.yaml.
The archive is immutable by convention. If you change the chart, bump version and package again. Registries and repositories identify a chart by name and version, so reusing a version causes confusion and stale caches.
helm lint ./webapp
helm package ./webappThe output is webapp-0.1.0.tgz in the current directory. Use --destination ./dist to write it elsewhere.
Dependencies and packaging
If Chart.yaml declares dependencies, the archive must contain them under charts/. Run helm dependency update ./webapp before packaging. You can also pass --dependency-update to helm package. This downloads each subchart and writes a Chart.lock file that pins exact versions.
Files listed in .helmignore are left out of the archive. Add things like .git/, test fixtures, and local values files there.
Versions: chart and app
Two fields in Chart.yaml change for different reasons:
| Field | Meaning | Change it when |
|---|---|---|
| `version` | Version of the chart itself | Any template, default, or dependency changes |
| `appVersion` | Version of the application deployed | You ship a new application image |
Both version and appVersion can be overridden at package time with --version and --app-version. This is handy in CI, where a pipeline stamps the build number into the archive.
version must follow semantic versioning. A pre-release such as 0.2.0-rc.1 is only selected when a user asks for it explicitly.
Publishing to an OCI registry
Helm can store charts in any OCI-compatible registry, such as Amazon ECR, GitHub Container Registry, or Harbor. Log in, then push the archive.
helm registry login registry.example.com
helm package ./webapp
helm push webapp-0.1.0.tgz oci://registry.example.com/charts
helm install my-release oci://registry.example.com/charts/webapp --version 0.1.0Notice that the push URL stops at charts. Helm appends the chart name and uses the version as the image tag. The install URL includes the chart name, charts/webapp.
Publishing to an HTTP repository
A classic chart repository is a web server that hosts .tgz files and an index.yaml file listing them. Generate the index with helm repo index.
helm repo index ./dist --url https://charts.example.comUpload the archives and index.yaml to your web host. Users then add the repository and install by name.
helm repo add example https://charts.example.com
helm repo update
helm install my-release example/webapp --version 0.1.0To add a new version, package it into the same directory and run helm repo index with --merge index.yaml. Without --merge, the old entries disappear from the index.
Common errors
- Version already exists. Some registries reject a push of an existing tag. Bump
versioninstead of overwriting. - Missing dependencies. Packaging fails or the archive lacks subcharts when
charts/is out of date. Runhelm dependency update. - Wrong push path. Including the chart name in the
helm pushURL creates a nested path such aswebapp/webapp. - Stale repository cache. After publishing to an HTTP repository, run
helm repo updatebefore searching or installing.
Exercise
You changed a template in the webapp chart but did not touch Chart.yaml. You then ran helm package and helm push to a registry that rejects existing tags. The push fails. What should you do, and why?
Show answer
Increase version in Chart.yaml, for example from 0.1.0 to 0.1.1, then package and push again. Charts are identified by name and version, and published versions are meant to be immutable. Leave appVersion alone unless the application image changed too.