How to create multiple values files inside helm chart?



Helm Chart is a very feature-rich framework when you are working with complex Kubernetes cluster and deployment. Helm chart provides a very convenient way to pass values.yaml and use it inside your Helm Chart.

But for this article, we will focus on -

How to create multiple values files inside the helm chart?

Click on the blog post if you want to know more about How to pass environment variables inside your helm chart ?

Table of Content

  1. Create multiple values.yaml(e.g. my-first-value.yaml, my-second-value.yaml)
  2. Run Helm Install with multiple values.yaml

1. Create multiple values.yaml(e.g. my-first-value.yaml, my-second-value.yaml)

The first which we need to do is to create multiple values.yaml. So I will be creating two files -

  1. my-first-value.yaml
  2. my-second-value.yaml

The aim of both files to increase the replica count of my helm chart. So I will be defining the attribute replicaCount in both files.

Like I said we are trying to learn the concept here, but in your case, you can fill in any attribute as per your requirement into your values.yaml


1.1 Lets update my-first-value.yaml

As I said we are going to update the replica count, so first I am gonna put the replica count to 2

1replicaCount: 2

You must save the file before closing it.

1.2 Secondly update my-second-value.yaml

In this file, we are going to increase the replica count to 3. Although we are using the same attribute in both the files but you can insert some different attribute values based on your business need.

1replicaCount: 2 

2. Run Helm Install with multiple values.yaml

Now we have created multiple values.yaml .i.e. - my-first-value.yaml, my-second-value.yaml, its time to use both the files inside your helm install command.

Here the command for installing the helm chart using multiple values.yaml

1helm install -f my-first-value.yaml -f my-second-value.yaml  helloworldrelease helloworld


How to understand the command?

  1. helm install - You need to use this because you are trying to install the helm chart
  2. -f my-first-value.yaml -f my-second-value.yaml - This is how we pass multiple value.yaml inside helm install command
  3. helloworldrelease - It is a release name that can anything of your choice
  4. helloworld - Your actual helm chart name.

Conclusion

Hope this article helps you to build your understanding around using multiple values.yaml

For more similar discussion you can read more from the following threads -

  1. StackOverflow
  2. GitHub

Read More -

  1. Helm chart - How to Add/Install plugins
  2. Getting started with Helm Chart
  3. Helm chart - WordPress Installation with MariaDB on Kubernetes
  4. Helm chart - Build you first helm chart with Spring Boot
  5. Helm Chart - Convert Kubernetes YAML into Helm Chart YAML
  6. Helm Chart - Pass environment variables
  7. Helm Chart - Plugin
  8. Helm Chart - Dry Run Install
  9. Helm Chart - How to create multiple values files inside helm chart?