Introduction
In this tutorial, we will walk through the internal workflow of Helm when executing a Helm installation. This process remains the same whether you are pulling a Helm Chart from a remote repository or using a local chart on your machine.
By the end of this tutorial, you will have a deep understanding of how Helm loads, processes, and deploys Kubernetes resources.
Step-by-Step Helm Installation Process
Step 1: Loading the Chart and Dependencies
When you execute a helm install
command, Helm performs the following actions:
- Loads the Helm Chart:
- If it is a local chart, Helm loads it directly from your machine.
- If it is from a remote repository, Helm fetches the chart and loads it.
- Loads Chart Dependencies:
- If the chart depends on other charts (e.g., a database for an application), Helm retrieves those dependencies.
Example:
helm install mydb bitnami/mysql
Step 2: Parsing the Default values.yaml
Each Helm chart comes with a values.yaml
file containing default configurations. When Helm loads a chart:
- It reads
values.yaml
to extract default values. - The templates in the
templates/
directory contain placeholders for these values. - If custom values are provided, Helm overrides the defaults.
You can override default values using:
--set
option:
helm install mydb bitnami/mysql --set mysqlRootPassword=mysecurepassword
- Custom
values.yaml
file:
helm install mydb bitnami/mysql --values custom-values.yaml
Step 3: Generating Kubernetes YAML Files
Once Helm has finalized the values:
- It substitutes the values into the templates.
- It generates Kubernetes YAML manifests.
Example of a rendered Service manifest:
apiVersion: v1 kind: Service metadata: name: mydb-mysql spec: ports: - protocol: TCP port: 3306 targetPort: 3306 selector: app.kubernetes.io/name: mysql
Step 4: Converting YAML into Kubernetes Objects
Helm does not just forward the generated YAML to Kubernetes. Instead, it:
- Parses the YAML files into Kubernetes objects.
- Validates them against the Kubernetes schema to ensure they comply.
Step 5: Deploying Resources to Kubernetes
After successful validation, Helm:
- Sends the final YAML to Kubernetes.
- Kubernetes’ API server processes the YAML and creates the necessary resources (pods, services, deployments, etc.).
Important: Helm does not wait for Kubernetes to finish creating resources. As soon as Kubernetes accepts the YAML, Helm considers the installation successful.