DEV Community

Cover image for Helm — Dependencies
Md Shamim
Md Shamim

Posted on

4 1

Helm — Dependencies

In helm, one chart can be dependent on another chart. For instance, a WordPress application requires a database to start functioning. In helm, we can deploy WordPress as part of the parent chart and MySQL or any other required application as a dependency of the parent chart.

Helm charts store their dependencies in ‘charts/’. There are two different ways to add dependency charts to parent charts:

Listing all the dependencies inside the Chart.yaml file and helm will download the dependencies and store them in the ‘charts/’ Directory.

Manually populate the dependency chart inside the ‘charts/’ directory.

List dependencies inside the Chart.yaml file

Before listing dependencies in the Chart.yaml file, By default Chart.yaml file looks like this :

# Chart.yaml
apiVersion: v2
name: webserver
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
Enter fullscreen mode Exit fullscreen mode

Now, let's see how we can populate the dependencies into the Chart.yaml file:

dependencies:

- name: mysql
  version: "9.3.4"
  repository: "https://charts.bitnami.com/bitnami"
Enter fullscreen mode Exit fullscreen mode

After adding dependencies to the Chart.yaml file :

# Chart.yaml

apiVersion: v2
name: webserver
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
dependencies:
- name: mysql
  version: "9.3.4"
  repository: "https://charts.bitnami.com/bitnami"
Enter fullscreen mode Exit fullscreen mode

Using a simple helm command we can pull the chart from the repository defined in the dependencies field:

   helm dependency update [CHART] 
>> helm dependency update ~/webserver
Enter fullscreen mode Exit fullscreen mode

The above-defined command will generate .webserver/Chart.lock file as well as download all dependencies into the .webserver/charts directory

The Chart.lock file lists the exact versions of immediate dependencies and their dependencies and so on.

Read full article...

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs