Subcharts & Dependencies
A chart can depend on other charts (subcharts), letting you compose an app from reusable pieces.
Real applications are built from parts — a web app plus a database, a cache, a message queue. Helm lets a chart depend on other charts, called subcharts.
Two ways to get a subchart
- Declare it in
Chart.yamlunderdependenciesand let Helm fetch it. - Drop a chart directly into the
charts/folder.
When you install the parent, all subcharts install too, as part of the same release.
Example
# Chart.yaml
apiVersion: v2
name: my-app
version: 0.1.0
dependencies:
- name: postgresql
version: "15.5.0"
repository: https://charts.bitnami.com/bitnami
- name: redis
version: "19.0.0"
repository: https://charts.bitnami.com/bitnamiWhen to use it
- A developer declares the official Bitnami PostgreSQL chart as a dependency so their application chart installs the database automatically without requiring operators to run two separate helm install commands.
- A platform team composes a full observability stack chart that depends on Grafana, Prometheus, and Loki subcharts, allowing one helm install to set up the entire monitoring suite.
- A chart maintainer pins dependency versions with a semver constraint in Chart.yaml so the chart is tested against a known range of subchart versions and unexpected updates cannot break production.
More examples
Declare a dependency in Chart.yaml
Lists postgresql and redis as dependencies with semver constraints; alias lets you reference the subchart as 'db' in values.
# Chart.yaml
apiVersion: v2
name: myapp
version: 1.0.0
dependencies:
- name: postgresql
version: "13.x.x"
repository: https://charts.bitnami.com/bitnami
alias: db
- name: redis
version: ">=17.0.0"
repository: https://charts.bitnami.com/bitnamiFetch and install dependencies
Runs dependency update to pull the declared subcharts into charts/, then installs the parent chart which includes all dependencies.
helm dependency update ./myapp
# Downloads charts into myapp/charts/
helm install my-release ./myapp -n productionList resolved dependencies
Shows each declared dependency, its resolved version, repository URL, and whether the chart archive is present in charts/.
helm dependency list ./myapp
Discussion