How to set environment related values.yaml in Helm subcharts?

helm values.yaml environment variables
helm values reference other values
helm install override values
helm multiple values files
helm override subchart template
helm print values
helm template set default value
helm set values from file

I am currently deploying my applications in a Kubernetes cluster using Helm. Now I also need to be able to modify some parameter in the values.yaml file for different environments.

For simple charts with only one level this is easy by having different values-local.yaml and values-prod.yaml and add this to the helm install flag, e.g. helm install --values values-local.yaml.

But if I have a second layer of subcharts, which also need to distinguish the values between multiple environments, I cannot set a custom values.yaml.

Assuming following structure:

| chart
   | Chart.yaml
   | values-local.yaml
   | values-prod.yaml
   | charts
      | foo-app
         | Chart.yaml
         | values-local.yaml
         | values-prod.yaml
         | templates
            | deployments.yaml
            | services.yaml

This will not work since Helm is expecting a values.yaml in subcharts.

My workaround right now is to have an if-else-construct in the subchart/values.yaml and set this in as a global variable in the parent values.yaml.

    {{ - if }}
          replicas: 1
    {{ else if}}
          replicas: 2
    {{ end }}

   local: true

   prod: true

But I hope there is a better approach around so I do not need to rely on these custom flags.

I hope you can help me out on this.

Subcharts and Global Values, Next, let's create a simple template and values file for our mysubchart chart. There should already be a values.yaml in mychart/charts/mysubchart . We'll set it up  Subcharts and Global Values A parent chart can override values for subcharts. Helm has a concept of global values Let's set one in our mychart/values.yaml

Just an idea, needs to be fleshed out a bit more...

At KubeCon I saw a talk where they introduced a Kubernetes Operator called Lostromos. The idea was to simplify deployments to support multiple different environments and make maintaining these kinds of things easier. It uses Custom Resource definitions. I wonder if you can leverage Lostromos in this case. Your sub-charts would have a single values.yaml but use lostromos and a CRD to feed in the properties you need. So you would deploy the CRD instead and the CRD would trigger Lostromos to deploy your Helm chart.

Just something to get the ideas going but seemed like it might be worth exploring.

Values Files, If this is a subchart, the values.yaml file of a parent chart; A values file if passed into helm install or helm upgrade with the -f flag  A chart's values.yaml file; A values file supplied by helm install -f or helm upgrade -f; The values passed to a --set or --set-string flag on helm install or helm upgrade; When designing the structure of your values, keep in mind that users of your chart may want to override them via either the -f flag or with the --set option.

I'm currently getting my chart from stable/jenkins and am trying to set my values.yaml file. I have made the appropriate changes and try to run 'helm install -n --values= stable/jenkins but it continues to install the default values instead of the modified yaml file i created. To be more specific, I commented out the plug-in requirements in the yaml file since it has been causing my pod status to stay on 'Init:0/1' on Kubernetes.

Charts with different set of values for each environment · Issue , storm - Chart.yaml - values.yaml - requirements.yaml - charts - storm-dev - Chart. yaml - values.yaml - storm-prd Pass environment as value from cli: helm --set " global.env=staging" . A short note with example charts: vishal-biyani/helm-subchart-env-values Linked pull requests. All the actual values for templates are coming from subchart values.yaml files. I control the subchart values assignment by defining either dev-values or prd-values tag as true on the command line as true. helm install -n v1 . --set This approach kind of works on helm version 2.4.2.

Passing user parameters of the parent chart to the subchart (without , @jgoeres I've thought about a similar wrapper an uber-helm to control jinja- 2 to set dynamic vars in values.yaml ( for example different environments). Will just expand job to parse sub-chart values.yaml. easy enough. Is there a way to conditionally install a helm subchart based on global values.yaml? I've all my internal services and components as subcharts, and one of them is a messagequeue chart. In my dev and test environment (local k8s), I use RabbitMQ, and in staging and Prod (AKS), I use Azure Service Bus.

The Art of the Helm Chart: Patterns from the Official Kubernetes , And then I run helm install stable/mysql --values=mysqlvalues.yaml . in my chart but in a chart in which my chart is used as a subchart? The sonarqube chart applies a similar approach directly to environment variables,  Individual parameters passed with --set (such as helm install --set foo=bar ./mychart) The list above is in order of specificity: values.yaml is the default, which can be overridden by a parent chart's values.yaml, which can in turn be overridden by a user-supplied values file, which can in turn be overridden by --set parameters.

Working with chart dependencies, Each subchart in the SUBCHART_DIR is a chart by itself with the similar files requirements.yaml dependencies: - name: nginx version: "1.2.3" repository: werf is compatible with Helm settings, so by default werf helm dependency NOTE secret-values.yaml files from subcharts will not be used during deploy process. Nope that's not possible, but there is a workaround to achieve the functionality, a change in the directory structure will be required. Before reading any further check out the similar question here How to set environment related values.yaml in Helm subcharts? The above scenario can be achieved with the following directory structure:

  • It's not clear whether this is an answer to the OP question, or a new question. As an answer, it lacks detail and/or links to documentation or an example. As a question, you can search for similar questions, or refer to the related and linked questions on the right-hand side of the page to find an answer. If you have a related but different question, ask a new question, and include a link to this one to help provide context. See: Ask questions, get answers, no distractions