How to Use the Command 'helm install' (with examples)
The helm install
command is an integral part of the Helm tool, which is the package manager for Kubernetes. It simplifies the deployment of applications within a Kubernetes cluster by facilitating the management of complex applications. The command primarily functions to install Helm charts, which are pre-configured Kubernetes resources, thereby automating the deployment process and standardizing the deployment of applications and infrastructures. Below are detailed use cases illustrating the versatility of helm install
.
Use case 1: Install a helm chart
Code:
helm install name repository_name/chart_name
Motivation:
This is the most straightforward use case for deploying an application within Kubernetes. By specifying the chart from a repository, you are leveraging pre-configured settings for common applications, which significantly speeds up the deployment process and ensures consistent configurations.
Explanation:
install
: This command tells Helm to initiate the installation process.name
: This is the name you provide for your release inside Kubernetes, which helps in identifying different deployments.repository_name/chart_name
: This points to the specific chart hosted in a Helm repository. It’s akin to selecting a software package from a repository in traditional software package managers.
Example output:
NAME: name
LAST DEPLOYED: Mon Jan 1 15:04:05 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
Use case 2: Install a helm chart from an unpacked chart directory
Code:
helm install name path/to/source_directory
Motivation:
There might be instances where you have a local copy of a Helm chart, perhaps with specific configurations or developmental changes not yet available in a repository. Using a local directory ensures these bespoke configurations are deployed.
Explanation:
install
: Initiates the installation of the chart.name
: Specifies the release name for the deployment.path/to/source_directory
: This is a local path pointing to the directory containing the Helm chart. It allows for modifications and testing of charts before publishing to a repository.
Example output:
NAME: name
LAST DEPLOYED: Tue Jan 2 16:05:06 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
Use case 3: Install a helm chart from a URL
Code:
helm install package_name https://example.com/charts/packagename-1.2.3.tgz
Motivation:
This is particularly useful when a chart is hosted remotely but not stored in a Helm repository. It allows you to deploy applications using charts stored on remote servers, facilitating easy testing and deployment of new releases referred to by versioned URLs.
Explanation:
install
: Starts the installation process.package_name
: The name given to your deployment release.https://example.com/charts/packagename-1.2.3.tgz
: A direct link to the Helm chart package, enabling installation from a remote resource.
Example output:
NAME: package_name
LAST DEPLOYED: Wed Jan 3 17:06:07 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
Use case 4: Install a helm chart and generate a name
Code:
helm install repository_name/chart_name --generate-name
Motivation:
In scenarios where managing the uniqueness of release names is cumbersome, using the --generate-name
option provides a convenient way to let Helm automatically generate a distinctive name for the deployment.
Explanation:
install
: Triggers the installation of the chart.repository_name/chart_name
: Specifies the chart to be installed.--generate-name
: This flag tells Helm to automatically create a unique name for the release, which is useful for deployments where naming conventions are not strict.
Example output:
NAME: chart-name-1234
LAST DEPLOYED: Thu Jan 4 18:07:08 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
Use case 5: Perform a dry run
Code:
helm install name repository_name/chart_name --dry-run
Motivation:
Before fully committing to a deployment, it’s often wise to simulate the process to ensure everything would work as expected. The dry run functionality allows debugging and adjustments by running the configuration without actual deployment.
Explanation:
install
: Begins the install process in a simulated environment.name
: The release name for the installation simulation.repository_name/chart_name
: Specifies the chart to be simulated for installation.--dry-run
: Executes the command in a simulated mode to ensure all configurations are correct without making any changes to the live cluster.
Example output:
Simulation successful: no changes made to cluster
Use case 6: Install a helm chart with custom values
Code:
helm install name repository_name/chart_name --set parameter1=value1,parameter2=value2
Motivation:
Customizing the configurations of a Helm chart at the time of installation is invaluable when you need to adjust specific parameters to match the requirements of your environment without altering the original chart.
Explanation:
install
: Commences the installation.name
: The release name under which your deployment will be known.repository_name/chart_name
: Identifies the specific chart for deployment.--set parameter1=value1,parameter2=value2
: Allows for on-the-fly configuration of the chart parameters, replacing defaults with specified values.
Example output:
NAME: name
LAST DEPLOYED: Fri Jan 5 19:08:09 2025
NAMESPACE: default
STATUS: deployed
REVISION: 1
Custom values applied: parameter1=value1, parameter2=value2
Use case 7: Install a helm chart passing a custom values file
Code:
helm install name repository_name/chart_name --values path/to/values.yaml
Motivation:
For more extensive customization needs or to maintain consistency across deployments, using a YAML file with all the values specified allows batch configuration changes, making it an efficient approach compared to setting individual values manually each time.
Explanation:
install
: Instigates the installation of the selected Helm chart.name
: The assigned name for the release deployment.repository_name/chart_name
: Represents the chart intended for installation.--values path/to/values.yaml
: Refers to a file containing key-value pairs for configuring the Helm chart, offering batch modifications ensuring configuration consistency and easier management.
Example output:
NAME: name
LAST DEPLOYED: Sat Jan 6 20:09:10 2026
NAMESPACE: default
STATUS: deployed
REVISION: 1
Configurations loaded from values.yaml
Conclusion:
The helm install
command is a highly versatile tool in deploying applications within a Kubernetes cluster, addressing a multitude of scenarios—from using default charts from repositories to customizing deployments with bespoke configurations. By understanding these various use cases, Kubernetes administrators can greatly enhance their deployment workflows, ensuring efficient, consistent, and error-free application rollouts.