How to install a specific version of a Helm Chart

For Installing a Specific Version of a Helm Chart

Managing applications on Kubernetes has become simpler with Helm, the powerful package manager for Kubernetes. But sometimes, you may want to install a specific version of a Helm chart, either for stability or compatibility reasons. In this guide, we’ll walk through how to find, install, and even upgrade specific versions of Helm charts in a few simple steps.

What is a Helm Chart?

Before diving into specifics, let’s quickly recap what a Helm chart is. A Helm chart is a collection of files that define a set of Kubernetes resources. Helm allows you to package, configure, and manage Kubernetes applications, making deployments more manageable and reusable.

Why Install a Specific Version?

There are many cases when you may need a specific version of a Helm chart:

  • Compatibility: Certain versions of an application may be compatible only with specific Kubernetes versions.
  • Stability: If a newer version introduces changes, you may prefer to stick to a known stable version.
  • Environment Consistency: In staging and production environments, using specific versions can help ensure consistency.

Steps to Install a Specific Version of a Helm Chart

Installing a specific version is easy with Helm, but first, let’s check which versions are available.

1. Find Available Versions of a Helm Chart

The first step is to find the specific versions of the Helm chart you’re interested in. Helm provides an easy way to do this with the helm search repo command, which allows you to list all available versions of a chart in a repository.

helm search repo <repo-name>/<chart-name> --versions
  • Replace <repo-name> with the name of the repository, like bitnami.
  • Replace <chart-name> with the name of the chart, like nginx.

For example, if you want to see all versions of the Bitnami NGINX chart, you would run:

helm search repo bitnami/nginx --versions

This will list all the available versions for the nginx chart in the Bitnami repository.

2. Install the Specific Version of a Helm Chart

Once you know the specific version you want to install, use the helm install command with the --version flag to install that version:

helm install <release-name> <repo-name>/<chart-name> --version <chart-version>
  • <release-name>: This is the name you want to give to your Helm deployment, such as my-nginx.
  • <repo-name>/<chart-name>: This is the repository and chart name, like bitnami/nginx.
  • <chart-version>: This is the version number of the chart you want to install.

Example:

Suppose you want to install version 9.3.17 of the Bitnami NGINX chart:

helm install my-nginx bitnami/nginx --version 9.3.17

This command will install the specified version (9.3.17) of the nginx chart from the Bitnami repository. Helm will create a release named my-nginx for this installation.

3. Upgrade to a Specific Version (If Already Installed)

If you already have a release installed and want to upgrade it to a specific version, use the helm upgrade command with the --version flag. This is especially useful if you need to change the version of an existing release without disrupting your setup.

helm upgrade <release-name> <repo-name>/<chart-name> --version <chart-version>

Example:

If you already have my-nginx deployed and want to upgrade it to version 9.3.17, you would run:

helm upgrade my-nginx bitnami/nginx --version 9.3.17

This upgrades your existing my-nginx deployment to the specified version of the NGINX chart.

4. Adding Custom Values (Optional)

In many cases, you may want to provide additional configuration to customize your Helm installation. Helm allows you to do this with a custom values.yaml file or by setting individual values directly in the command.

Using a Custom Values File

To specify a custom configuration file, use the -f flag followed by the file path:

helm install my-nginx bitnami/nginx --version 9.3.17 -f custom-values.yaml

Here, custom-values.yaml contains the configuration overrides for this installation.

Using Inline Configuration

Alternatively, you can set individual configuration values inline using the --set option:

helm install my-nginx bitnami/nginx --version 9.3.17 --set key1=value1,key2=value2

This is a quick way to set a few values directly in the command.

Summary: Installing and Managing Specific Helm Chart Versions

Helm makes it easy to manage application versions on Kubernetes by allowing you to specify the exact version of a chart to install or upgrade to. Here’s a quick summary of the commands we covered:

  • Find versions: helm search repo <repo-name>/<chart-name> --versions
  • Install specific version: helm install <release-name> <repo-name>/<chart-name> --version <chart-version>
  • Upgrade to a specific version: helm upgrade <release-name> <repo-name>/<chart-name> --version <chart-version>
  • Customize installation: Use -f custom-values.yaml or --set key=value for configurations.

With these simple commands, you can confidently install, manage, and customize specific versions of Helm charts in your Kubernetes environment, ensuring consistency, stability, and compatibility across your deployments.

Tags

Post a Comment

0 Comments