Subcharts & dependencies
Compose charts; share values.
A chart can depend on other charts — subcharts — declared in Chart.yaml. Installing an app that needs Postgres and Redis can pull in their charts as dependencies rather than you re-templating a database. You list dependencies with a name, version, and repository, then helm dependency update fetches them into charts/. This is how big applications are assembled from reusable pieces.
dependencies:- name: postgresqlversion: "15.5.x"repository: https://charts.bitnami.com/bitnamicondition: postgresql.enabled # toggle the subchart on/off- name: redisversion: "19.x.x"repository: https://charts.bitnami.com/bitnami# helm dependency update -> fetches these into charts/
Passing values to subcharts
Parent values reach a subchart under a key matching the subchart name, so postgresql: { auth: { database: payments } } in the parent’s values configures the postgresql subchart. A condition (postgresql.enabled) lets consumers turn a dependency off — deploy with the bundled database in dev, disable it and point at a managed database in prod. global values are shared across all subcharts for things like a common image registry.
postgresql:enabled: trueauth:database: paymentsexistingSecret: pg-credentials # subchart config, keyed by subchart nameglobal:imageRegistry: registry.internal # shared with every subchart