Sub topic 3
Fetching and locking dependencies
This chapter assumes you know Helm 3 basics (install, upgrade, release), the chart layout, and how to read a Chart.yaml. You will learn what the three helm dependency commands do, how Chart.lock pins versions, and what ends up in charts/.
Why declaring is not enough
The dependencies list in Chart.yaml only states what the chart needs. Helm does not fetch anything when you install. It reads subcharts from the charts/ directory inside your chart. If a declared dependency is missing from charts/, helm install fails with an error saying the dependencies are not met.
Three commands close that gap. Here they run against the webapp chart from the previous chapter:
helm dependency update ./webapp
helm dependency list ./webapp
helm dependency build ./webapphelm dependency update
helm dependency update (alias helm dep up) does four things:
- Reads the
dependencieslist inChart.yaml. - Resolves each version constraint against the repository index. A constraint such as
~1.2.0allows patch releases (>=1.2.0, <1.3.0), so Helm picks the newest match. - Downloads each chart as a
.tgzarchive intocharts/. - Writes
Chart.lockwith the exact versions it chose.
For a file:// dependency such as common-helpers, Helm packages the local chart directory into an archive and places it in charts/ as well. The path is resolved relative to the parent chart.
Repositories referenced by URL must be known to Helm. If a https:// repository is not in your local list, add it first with helm repo add. Otherwise the command fails with an error asking you to add the repository.
Chart.lock
Chart.lock records the resolved result of the constraints. A lock file for webapp looks like this:
dependencies:
- name: cache
repository: https://charts.example.com/stable
version: 1.2.7
- name: common-helpers
repository: file://../common-helpers
version: 0.1.0
digest: sha256:3a1f0c5e8d2b7c94e6a05f1b7d8c2e4a9b6f3d1c0e7a8b5d4c3f2e1a0b9c8d7e
generated: "2026-12-05T07:35:34.874Z"The version fields are exact. The digest is a hash of the dependencies section of Chart.yaml. Helm uses it to detect that the declaration changed after the lock was written. Commit Chart.lock to version control. It makes builds repeatable, because a teammate or a CI job gets 1.2.7 and not whatever ~1.2.0 matches on that day.
helm dependency build
helm dependency build (alias helm dep build) rebuilds charts/ from Chart.lock, not from the constraints in Chart.yaml. It downloads the exact locked versions and never rewrites the lock file. Use it in CI and in Docker builds.
If Chart.yaml and Chart.lock disagree, which the digest reveals, build stops with an error. Run helm dependency update to refresh the lock.
The difference is the main decision rule of this chapter:
| Command | Reads | Writes `Chart.lock` | Use it when |
|---|---|---|---|
| `helm dependency update` | `Chart.yaml` constraints | Yes | You add or change a dependency, or want newer versions |
| `helm dependency build` | `Chart.lock` | No | You need a reproducible `charts/` from a known state |
| `helm dependency list` | `Chart.yaml` and `charts/` | No | You want to check the current state |
helm dependency list
helm dependency list prints one row per declared dependency, with its name, version constraint, repository, and a status. The common statuses are:
ok: a matching archive is present incharts/.missing: no archive is present. Runupdateorbuild.wrong version: an archive exists, but its version does not satisfy the constraint.unpacked: the dependency is an unpacked directory, not an archive.
Run list after any change to Chart.yaml to see whether charts/ is out of date.
What lives in charts/
After update, the charts/ directory holds one archive per dependency:
webapp/
Chart.yaml
Chart.lock
values.yaml
templates/
charts/
cache-1.2.7.tgz
common-helpers-0.1.0.tgzHelm loads these archives and renders them together with the parent chart as part of one release. You can also drop a chart into charts/ by hand, but then Chart.lock does not track it.
Common errors
- "found in Chart.yaml, but missing in charts/ directory": you declared a dependency but never fetched it. Run
helm dependency update. - "no repository definition for ...": the repository URL is not registered. Run
helm repo addwith that URL, then retry. - Lock out of sync: you edited
dependenciesand ranbuild. Runupdatefirst. - Ignored archives in Git: some teams add
charts/*.tgzto.gitignoreand rely onbuildin CI. This works only ifChart.lockis committed.
Exercise
A teammate changes the cache dependency constraint in Chart.yaml from "~1.2.0" to "~1.3.0" and runs helm dependency build ./webapp. What happens, and what should they run instead?
Show answer
The build fails or does not pick up the change. build uses Chart.lock, and the lock's digest no longer matches the edited dependencies section of Chart.yaml. They should run helm dependency update ./webapp to resolve the new constraint, download the new archive, and rewrite Chart.lock. Then they should commit the new Chart.lock.
Exercise
Your CI job must produce the same charts/ contents as the developer who last updated the chart. Which command do you use, and which file must be committed?
Show answer
Use helm dependency build, and commit Chart.lock. Build downloads the exact versions recorded in the lock file without re-resolving constraints.