How to use the command "helm install" (with examples)
“Helm install” is a command used in the Helm package manager to install a Helm chart. A Helm chart is a collection of files that describes a specific Kubernetes application or service. The “helm install” command allows users to easily deploy and manage applications on a Kubernetes cluster using pre-configured charts.
Use case 1: Install a helm chart
Code:
helm install name repository_name/chart_name
Motivation: This use case is for installing a Helm chart by specifying the repository name and chart name. It is useful when you know the exact repository and chart name you want to install.
Explanation: The helm install
command is followed by the desired name for the release, which can be any string. Next, you specify the repository name and chart name using the format repository_name/chart_name
.
Example output:
NAME: my-release
LAST DEPLOYED: Mon Feb 24 17:39:16 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
Use case 2: Install a helm chart from an unpacked chart directory
Code:
helm install name path/to/source_directory
Motivation: This use case allows users to install a Helm chart from a directory on their local machine. It is useful when you want to modify the chart files before installing.
Explanation: The helm install
command is followed by the desired name for the release, which can be any string. Next, you specify the path to the source directory containing the unpacked chart files.
Example output:
NAME: my-release
LAST DEPLOYED: Mon Feb 24 17:45:25 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
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 use case allows users to install a Helm chart directly from a URL, without needing to download and unpack the chart files locally. It is useful when you want to quickly install a chart from an external source.
Explanation: The helm install
command is followed by the desired name for the release, which can be any string. Next, you specify the URL of the chart package you want to install.
Example output:
NAME: my-release
LAST DEPLOYED: Mon Feb 24 17:51:12 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
Use case 4: Install a helm chart and generate a name
Code:
helm install repository_name/chart_name --generate-name
Motivation: This use case allows users to install a Helm chart and automatically generate a name for the release. It is useful when you don’t want to manually specify a name for the release.
Explanation: The helm install
command is followed by the repository name and chart name using the format repository_name/chart_name
. The --generate-name
flag tells Helm to automatically generate a name for the release.
Example output:
NAME: busy-tarsier
LAST DEPLOYED: Mon Feb 24 17:56:43 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
Use case 5: Perform a dry run
Code:
helm install name repository_name/chart_name --dry-run
Motivation: This use case allows users to perform a dry run of the installation process without actually installing the chart. It is useful for validating the installation process and checking for any potential issues.
Explanation: The helm install
command is followed by the desired name for the release, which can be any string. Next, you specify the repository name and chart name using the format repository_name/chart_name
. The --dry-run
flag tells Helm to simulate the installation process without making any changes to the cluster.
Example output:
NAME: my-release
LAST DEPLOYED: Mon Feb 24 18:02:30 2022
NAMESPACE: default
STATUS: pending-install
REVISION: 1
TEST SUITE: None
Use case 6: Install a helm chart with custom values
Code:
helm install name repository_name/chart_name --set parameter1=value1,parameter2=value2
Motivation: This use case allows users to install a Helm chart while overriding specific values defined in the chart’s values.yaml file. It is useful when you want to customize the installation based on your specific requirements.
Explanation: The helm install
command is followed by the desired name for the release, which can be any string. Next, you specify the repository name and chart name using the format repository_name/chart_name
. The --set
flag is used to override specific parameters defined in the chart’s values.yaml file. Multiple parameters can be overridden by separating them with commas.
Example output:
NAME: my-release
LAST DEPLOYED: Mon Feb 24 18:07:57 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
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: This use case allows users to install a Helm chart while providing a custom values.yaml file containing the desired configuration. It is useful when you want to customize the installation using a separate values file.
Explanation: The helm install
command is followed by the desired name for the release, which can be any string. Next, you specify the repository name and chart name using the format repository_name/chart_name
. The --values
flag is used to specify the path to a custom values.yaml file to be used for the installation.
Example output:
NAME: my-release
LAST DEPLOYED: Mon Feb 24 18:12:05 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
Conclusion:
The “helm install” command is a powerful tool that allows users to easily install pre-configured Helm charts on a Kubernetes cluster. With the various use cases provided, users can install charts from repositories, local directories, or URLs, customize the installation using custom values, and perform dry runs for validation purposes. Helm greatly simplifies the deployment process for Kubernetes applications and services.