Feedback

Chat Icon

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Introduction to Helm
91%

What Happens When You Install a Chart?

To understand how Helm manages dependencies during installation, let's summarize the whole process of installing a chart with dependencies. When you run the command:

helm install my-release kube-prometheus-stack

The following actions take place:

  1. Helm will check if the dependencies are already present in the local cache (in the folder /root/.cache/helm/repository).

  2. If they are not present, it will determine the repository URL and the version of each dependency from the Chart.yaml file.

  3. It will then download the corresponding .tgz archives from the repositories, extract them, and store them locally in the cache.

  4. It always starts with a folder called crds/ that may contain Custom Resource Definitions used by the chart.

  5. It then moves to the dependencies of the dependencies, and so on, until it reaches the top-level chart.

  6. The order of installation is important because some charts may depend on others. Helm uses hooks usually defined in the annotations section of the metadata to manage the order of installation.

Example:

metadata:
  name: a-dependency
  annotations:
    "helm.sh/hook": pre-install
    "helm.sh/hook-weight": "0"

The pre-install hook indicates that this resource should be created before the main chart is installed. If other resources have the same hook, the helm.sh/hook-weight annotation determines the order in which they are created:

  • Helm uses the ascending order of weights to install resources. Lower weight resources are installed before higher weight ones.
  • If two hooks share the same weight, they’re ordered lexicographically by name.
  • Weight can be a negative or positive integer.
  • If no weight is specified, it defaults to 0.

Example:

# Runs first
metadata:
  annotations

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Enroll now to unlock all content and receive all future updates for free.