When working with Helm, a popular package manager for Kubernetes, you might often need to retrieve values from a YAML chart. This task, while fundamental, can sometimes prove challenging, especially for beginners. This article will guide you through the process of getting values from a Helm chart in a simple, step-by-step manner.

Before we dive in, let's ensure you have a basic understanding of Helm and its key components. Helm uses a packaging format called charts, which are collections of files that describe a related set of Kubernetes resources. Now, let's explore how to extract values from these charts.

Retrieving Values from a Helm Chart
The core of a Helm chart is its values.yaml file. This file contains the default values for all the configurable parameters of your chart. To retrieve values from this file, you can use the helm get values command.

However, before running this command, ensure you have the chart installed in your Kubernetes cluster. If you haven't, you can use the helm install command followed by the chart name and the path to your chart's directory. For instance, helm install my ReleaseName ./path/to/chart
Basic Usage: Get All Values

The simplest way to use helm get values is to retrieve all the values from your chart. This can be done by running:
helm get values RELEASE_NAME
Replace RELEASE_NAME with the name you provided during installation. This command outputs all the values from the values.yaml file, prefixed with their keys.
Filtering Output: Get Specific Values

However, it's not always necessary to fetch all the values. Sometimes, you might only need specific ones. In such cases, you can use the -n or --names flag followed by the names of the values you want to retrieve. Here's the syntax:
helm get values --names VALUE_NAME1 VALUE_NAME2... RELEASE_NAME
Replace the VALUE_NAMES with the keys of the values you're interested in. Separate multiple names with spaces. For example, to get only the values replicaCount and service.type, you'd run:
helm get values --names replicaCount service.type myRelease
This command will display only the specified values from your chart.

Dealing with Overridden Values
During chart installations, you can override default values using the --values or -f flags. If you're curious about these overridden values, you can still use helm get values, which will display all values as they were set during the last installation.









If you're dealing with overridden values and want to know the original defaults, you can use the --show terefs flag. This flag shows where each value came from, helping you trace the origin of specific values.
Displaying Value Origins: Using temberefs
Here's how you can use the --show-terefs flag to display the origins of values:
helm get values --show-terefs RELEASE_NAME
This command shows you not only the values but also the file and line number where each value was defined.
Getting Values for Specific Releases
If you have multiple instances of a chart installed and want to get values for a specific release, you can simply replace RELEASE_NAME in the commands above with the name of the release you're interested in. For example:
helm get values myOtherRelease
This command retrieves the values for the release named myOtherRelease.
You've now learned how to efficiently retrieve values from Helm charts, making your workflow with Kubernetes more manageable. Time to put these commands to use and streamline your process! Always remember to check the Helm documentation for the most recent and detailed information. Happy charting!