Managing Dependencies

helm dependency update reads Chart.yaml, downloads the listed subcharts into charts/, and writes a lock file.

Syntaxhelm dependency update <chart-path>

After listing dependencies in Chart.yaml, you must fetch them before installing. That is what the helm dependency commands do.

The commands

  • helm dependency update — download all listed dependencies into charts/ and write Chart.lock.
  • helm dependency build — rebuild charts/ from an existing Chart.lock (reproducible).
  • helm dependency list — show declared dependencies and their status.

Chart.lock

Like a package lock file, Chart.lock pins the exact resolved versions so every build is reproducible. Commit it to version control.

Example

Example · bash
# Add the repos the dependencies come from
helm repo add bitnami https://charts.bitnami.com/bitnami

# Download the subcharts declared in Chart.yaml
helm dependency update ./my-app

# List and verify
helm dependency list ./my-app

When to use it

  • A developer runs helm dependency update after adding a new subchart to Chart.yaml to download the chart archive into the charts/ directory before running helm install.
  • A CI pipeline runs helm dependency update as the first step so cached chart archives are refreshed, ensuring the build never uses a stale or missing subchart.
  • A chart maintainer checks the generated Chart.lock file into source control after running dependency update so team members can reproduce the exact same subchart versions with helm dependency build.

More examples

Update all dependencies

Refreshes the chart repository index, then downloads all declared dependencies into the charts/ directory.

Example · bash
helm repo update
helm dependency update ./myapp
ls myapp/charts/

Build from locked versions

Installs the exact subchart versions pinned in Chart.lock rather than resolving version constraints, ensuring reproducible builds.

Example · bash
# Uses Chart.lock to install exact versions (no network version resolution)
helm dependency build ./myapp

Chart.lock example

Shows the lock file Helm writes after dependency update, pinning exact resolved versions for reproducible builds.

Example · yaml
# Chart.lock (auto-generated, commit to source control)
dependencies:
- name: postgresql
  repository: https://charts.bitnami.com/bitnami
  version: 13.2.0
- name: redis
  repository: https://charts.bitnami.com/bitnami
  version: 18.1.5
generated: "2024-03-15T10:00:00.000000000Z"

Discussion

  • Be the first to comment on this lesson.