Chart Dependencies
Chart Dependencies define how Helm charts integrate with other charts, enabling modular and reusable Kubernetes application deployments.
Chart Dependencies define the relationships between a Helm chart and other charts it requires to function properly. These dependencies are other Helm charts that are packaged separately but must be installed alongside or within the parent chart to provide additional functionality, services, or components. Declaring dependencies enables modular design, reuse of common functionality, and easier management of complex applications by composing several charts together.
Dependency Declaration
Dependencies are declared in the Chart.yaml file of a Helm chart within the dependencies section. Each dependency entry specifies essential metadata about the dependent chart, including:
name: The name of the dependent chart.version: The version constraint or exact version of the dependent chart required.repository: The URL or alias of the chart repository where the dependency is located.condition(optional): A Helm value path that can enable or disable the dependency dynamically.tags(optional): Tags that group dependencies and allow selective enabling or disabling.import-values(optional): Specifies which values from the dependency should be merged into the parent chart’s values.aliases(optional): Alternate names to refer to the dependency, allowing multiple instances of the same chart with different configurations.
Example dependency declaration in Chart.yaml:
dependencies:
- name: redis
version: "^14.4.0"
repository: "https://charts.bitnami.com/bitnami"
condition: redis.enabled
tags:
- cache
import-values:
- data
Dependency Resolution and Management
Helm provides commands and mechanisms to manage chart dependencies:
helm dependency update: Downloads and updates the dependencies specified inChart.yamlinto thecharts/directory in the chart package. This ensures all required charts are available locally before installation or packaging.helm dependency build: Similar to update, it builds the dependencies based on the declared metadata.helm dependency list: Lists the current dependencies, their version, repository, and status.helm dependency verify: Validates the integrity and provenance of dependencies using checksums.
Dependencies are resolved by fetching the specified versions of charts from remote repositories or local paths and unpacking them into the charts/ folder, allowing Helm to treat them as part of the main chart during installation.
Conditions, Tags, and Aliases in Dependencies
Conditions
Conditions allow enabling or disabling a dependency through Helm values. If the condition path evaluates to true, the dependency will be included during chart installation; if false, it will be skipped. This enables dynamic control over optional components.
Example:
dependencies:
- name: redis
version: "10.5.7"
repository: "https://charts.bitnami.com/bitnami"
condition: redis.enabled
If redis.enabled is set to false in values.yaml, the Redis dependency will be ignored.
Tags
Tags group multiple dependencies so they can be enabled or disabled collectively. A tag is defined on each dependency and selected in the Helm command or values. This is useful for managing related features as a unit.
Example:
dependencies:
- name: redis
version: "10.5.7"
repository: "https://charts.bitnami.com/bitnami"
tags:
- database
- name: postgresql
version: "8.9.5"
repository: "https://charts.bitnami.com/bitnami"
tags:
- database
By enabling the database tag, both redis and postgresql dependencies can be included or excluded together.
Aliases
Aliases allow the same dependency chart to be included multiple times under different names with different configurations. This is useful when an application needs multiple instances of the same component.
Example:
dependencies:
- name: redis
alias: redis-primary
version: "10.5.7"
repository: "https://charts.bitnami.com/bitnami"
- name: redis
alias: redis-secondary
version: "10.5.7"
repository: "https://charts.bitnami.com/bitnami"
Each alias creates a separate instance of the Redis chart with its own configuration namespace.
Importing Values from Dependencies
The import-values field allows selected values from a dependency chart to be merged into the parent chart’s values. This facilitates centralized configuration and customization of dependent charts without modifying their internal values directly.
Example:
dependencies:
- name: redis
version: "10.5.7"
repository: "https://charts.bitnami.com/bitnami"
import-values:
- data
- metrics
The specified keys under import-values will be merged from the Redis chart’s values into the parent chart’s values for easier access and override.
Dependency Locking
Helm supports locking dependencies to exact versions using a Chart.lock file. This file records the resolved versions and checksums of all dependencies at the time of the last update or build. Locking ensures reproducible chart installations by preventing automatic upgrades or changes to dependencies without explicit update commands.
The lock file format includes:
- Chart name
- Version
- Repository URL
- Digest (checksum)
Users commit this file to version control to guarantee consistent dependency resolution across environments.
Summary of Chart Dependencies Content
- Declared in
Chart.yamlunderdependencies. - Include
name,version,repository, and optional fields likecondition,tags,aliases, andimport-values. - Managed with Helm CLI commands for updating, listing, verifying, and building.
- Enable modular, reusable, and configurable charts by composing multiple charts.
- Support dynamic enablement via conditions and tags.
- Allow multiple instances via aliases.
- Facilitate centralized configuration using import-values.
- Ensure reproducibility with a lock file capturing exact versions and checksums.
Chart dependencies are fundamental to Helm's capability to manage complex applications as collections of interconnected components, simplifying deployment, upgrades, and lifecycle management.