DEV Community

DevCorner
DevCorner

Posted on

Helm Installation and Usage Guide for Kubernetes (Step-by-Step)

Helm is a package manager for Kubernetes, simplifying application deployment using predefined templates called Helm charts. This guide will cover everything you need to install and use Helm, including practical commands and examples.


πŸ›  Prerequisites

Before we begin, ensure you have:

  • A Kubernetes cluster running (e.g., Minikube, Kind, or a cloud-based cluster like AKS, EKS, GKE).
  • kubectl installed and configured.
  • Basic understanding of Kubernetes objects like Deployments, Services, and ConfigMaps.

1️⃣ Installing Helm

Helm needs to be installed on your local machine before using it.

πŸ”Ή Installing Helm on Linux & macOS

Run the following commands:

curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can use package managers:

For macOS (Homebrew):

brew install helm
Enter fullscreen mode Exit fullscreen mode

For Linux (Snap package manager):

sudo snap install helm --classic
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Installing Helm on Windows

If you have Chocolatey installed:

choco install kubernetes-helm
Enter fullscreen mode Exit fullscreen mode

If you have Scoop installed:

scoop install helm
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can download the binary from the official Helm releases.


πŸ”Ή Verify Helm Installation

After installation, check if Helm is installed properly:

helm version
Enter fullscreen mode Exit fullscreen mode

Expected output:

version.BuildInfo{Version:"v3.x.x", GitCommit:"...", GitTreeState:"clean", GoVersion:"go1.x.x"}
Enter fullscreen mode Exit fullscreen mode

2️⃣ Understanding Helm Concepts

Before diving into deployment, let’s understand some key Helm concepts:

Concept Description
Chart A Helm package containing YAML files defining a Kubernetes application.
Repository A collection of Helm charts, similar to package managers like APT or YUM.
Release A deployed instance of a Helm chart in a Kubernetes cluster.

3️⃣ Adding a Helm Repository

Helm repositories store pre-built charts. To add a popular Helm chart repository, such as Bitnami, run:

helm repo add bitnami https://charts.bitnami.com/bitnami
Enter fullscreen mode Exit fullscreen mode

List all added repositories:

helm repo list
Enter fullscreen mode Exit fullscreen mode

Update the local repository cache:

helm repo update
Enter fullscreen mode Exit fullscreen mode

4️⃣ Searching for Helm Charts

You can search for available charts in a repository:

helm search repo bitnami
Enter fullscreen mode Exit fullscreen mode

For a specific application, like Nginx:

helm search repo bitnami/nginx
Enter fullscreen mode Exit fullscreen mode

5️⃣ Installing Applications using Helm

To deploy an application using a Helm chart, use:

helm install <release-name> <chart-name>
Enter fullscreen mode Exit fullscreen mode

Example: Installing Nginx from the Bitnami repository:

helm install my-nginx bitnami/nginx
Enter fullscreen mode Exit fullscreen mode

Check the installed release:

helm list
Enter fullscreen mode Exit fullscreen mode

Check the status of the release:

helm status my-nginx
Enter fullscreen mode Exit fullscreen mode

Verify the deployment:

kubectl get pods
Enter fullscreen mode Exit fullscreen mode

6️⃣ Viewing and Managing Installed Applications

To view details of an installed Helm release:

helm get all my-nginx
Enter fullscreen mode Exit fullscreen mode

To list all installed releases:

helm list
Enter fullscreen mode Exit fullscreen mode

To upgrade an existing Helm release:

helm upgrade my-nginx bitnami/nginx
Enter fullscreen mode Exit fullscreen mode

To uninstall an application:

helm uninstall my-nginx
Enter fullscreen mode Exit fullscreen mode

7️⃣ Customizing Helm Deployments (Values.yaml)

Helm allows customization using values.yaml files.

πŸ”Ή Checking Default Values

To check the default values of a chart:

helm show values bitnami/nginx > custom-values.yaml
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Modifying and Applying Custom Values

Edit custom-values.yaml and update necessary configurations, such as replica count or service type.

Example:

replicaCount: 3
service:
  type: LoadBalancer
Enter fullscreen mode Exit fullscreen mode

Then, install the chart with your custom values:

helm install my-nginx -f custom-values.yaml bitnami/nginx
Enter fullscreen mode Exit fullscreen mode

8️⃣ Helm Rollbacks

Helm allows rolling back to a previous version:

List revision history:

helm history my-nginx
Enter fullscreen mode Exit fullscreen mode

Rollback to a previous revision:

helm rollback my-nginx <revision-number>
Enter fullscreen mode Exit fullscreen mode

9️⃣ Creating a Helm Chart (Advanced)

To create your own Helm chart:

helm create my-chart
Enter fullscreen mode Exit fullscreen mode

This will generate a directory structure like:

my-chart/
β”œβ”€β”€ charts/
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ deployment.yaml
β”‚   β”œβ”€β”€ service.yaml
β”‚   β”œβ”€β”€ _helpers.tpl
β”œβ”€β”€ values.yaml
β”œβ”€β”€ Chart.yaml
Enter fullscreen mode Exit fullscreen mode

You can modify the templates/ folder to customize Kubernetes resources.

To install your custom chart:

helm install my-app ./my-chart
Enter fullscreen mode Exit fullscreen mode

πŸ”Ÿ Uninstalling Helm

To remove Helm completely from your system:

For Linux/macOS:

rm -rf ~/.helm
Enter fullscreen mode Exit fullscreen mode

For Windows:

rm -rf $HOME\AppData\Local\helm
Enter fullscreen mode Exit fullscreen mode

πŸš€ Conclusion

Helm simplifies Kubernetes deployments by managing applications as packages. In this guide, we covered:
βœ… Installing Helm

βœ… Adding repositories

βœ… Installing applications

βœ… Customizing deployments

βœ… Upgrading and rolling back applications

βœ… Creating custom Helm charts

With Helm, you can deploy complex applications with minimal effort. πŸš€

Let me know if you need further details or examples! 😊

Top comments (0)