How to Install and Use Helm on MacOS [Step by Step Guide]

How to Install and Use Helm on MacOS [Step by Step Guide]

In this tutorial, we will learn about “How to install and use Helm on MacOS by following step by step guide”. Helm is a package manager for Kubernetes which is used to simplify the process of defining, installing, and managing applications through reusable packages called charts. Installing and using Helm on MacOS allows you to streamline the deployment and management of applications on Kubernetes clusters.  Whether you’re a developer looking to simplify Kubernetes deployments or an operations engineer seeking efficient application management tools, getting familiar with Helm will enhance your productivity and effectiveness in managing cloud-native applications.

In today’s tutorial, we will learn about different method to install the Helm on MacOS. We will also look at how application charts are created and deployed using Helm. So, let us begin the tutorial.

 

Helm Overview

Helm is a powerful tool designed to streamline the management of applications deployed on Kubernetes clusters. Helm simplifies the deployment and management of complex applications on Kubernetes through package management, templating, versioning, and repository functionalities. It enhances the efficiency and reliability of managing cloud-native applications in Kubernetes environments. There are many features provided by Helm which makes it a better choice for a developer. Some of the important features of Helm are:

Package Management: Helm acts as a package manager for Kubernetes, allowing users to define, install, and manage applications using reusable packages known as charts.

Charts: Charts are packages of pre-configured Kubernetes resources, such as deployments, services, and ingress rules, simplifying the deployment process.

Templating Engine: Helm employs Go templates to enable users to parameterize Kubernetes manifests, facilitating configuration management and customization.

Version Control: Helm enables versioning of charts and rollback capabilities, ensuring reproducibility and reliability in application deployments.

Repository Management: Users can publish and consume Helm charts from repositories, fostering collaboration and sharing of best practices.

 

Different Ways to Install Helm on MacOS

Also Read: How to Install Helm 3 on CentOS 8 Using 5 Easy Steps

There are different ways available to install Helm on MacOS, You can choose any of the below methods to install the Helm depending on your use case and requirements. These methods are:

1. Homebrew: It is a package manager for macOS which is used to install packages on MacOS.

2. Shell Script: Helm provides a shell script for macOS installation.

3. Manual Download: You can manually download the Helm binary from the Helm GitHub releases page and add it to your system variable known as PATH.

 

How to Install Helm on MacOS [Step by Step Guide]

We have so far learnt about Helm and its usage. We saw that there are different ways to install the Helm on MacOS. So, let us look at each of the way one by one, starting with Homebrew.

1.  Using Homebrew

Step-1: Update the Homebrew package manager

In this step, update the homebrew package manager so that all the packages are available to their latest version and remove the obsoleted packages. This can be done using below command.

[email protected] ~ % brew update
==> Updating Homebrew...
Updated 2 taps (homebrew/core and homebrew/cask).

==> New Formulae
tartufo

==> New Casks
steinberg-activation-manager

 

Step-2: Install helm using Homebrew package manager

In this  step, use the command brew install helm to install the latest version of Helm software as shown below.

[email protected] ~ % brew install helm 

==> Downloading https://ghcr.io/v2/homebrew/core/helm/manifests/3.14.3
######################################################################### 100.0%
==> Fetching helm
==> Downloading https://ghcr.io/v2/homebrew/core/helm/blobs/sha256:124b261445e83

######################################################################### 100.0%
==> Pouring helm--3.14.3.arm64_sonoma.bottle.tar.gz
==> Caveats

zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions

==> Summary
🍺  /opt/homebrew/Cellar/helm/3.14.3: 65 files, 48.9MB
==> Running `brew cleanup helm`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

 

Step-3: Verify helm installation

In this step, to verify if the installation was successfully, execute the command helm version to check the installed version of Helm. If output returns the Helm version, it means installed is successful.

To check the installed helm version,

[email protected] ~ % helm version 
version.BuildInfo{Version:"v3.14.3", GitCommit:"f03cc04caaa8f6d7c3e67cf918929150cf6f3f12", GitTreeState:"clean", GoVersion:"go1.22.1"}

 

To check the path of helm binary,

[email protected] ~ % which helm
/opt/homebrew/bin/helm

 

To see the man page of helm,

[email protected] ~ % helm

 

2. Using Shell Script

Step-1: Download the script

In this step, download the helm installation script from the official Helm repository using below command. This command will save the script in the current directory with the name “get_helm.sh“.

[email protected] ~ % curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3

 

Step-2: Modify Script Permission

Next, assign the execution permission to the Helm script using below command. This will allow the current user to execute the script for installing Helm.

[email protected] ~ % chmod 700 get_helm.sh

 

Step-3: Install Helm

Next, after assigning the execution permission to the Helm script, install the Helm using command ./get_helm.sh as shown below.

[email protected] ~ % ./get_helm.sh

 

3. Using Manual Download

In this method, download the appropriate version of the Helm binary for MacOS from Helm GitHub releases . Ensure you select the correct architecture (usually darwin-amd64).

Next,  Extract the downloaded file. You can do this by double-clicking the downloaded archive file or using a tool like tar in the Terminal.

Next, Move the helm binary to a directory that is included in your system’s PATH environment variable, such as /usr/local/bin. You can do this using the Terminal with the mv command.

You are now all set to use the Helm to create your first chart. Let us now look at how to create chart and install it in local Kubernetes cluster.

 

Create chart using Helm

Step-1: Create Chart

In this step, create a chart using the command helm create <chart-name>. I have given the chart name as first-chart. You are free to give any name to your chart. This will create a new folder in the current directory with the chart name.

[email protected] ~ % helm create first-chart
Creating first-chart

[email protected] ~ % ls
first-chart

 

If you look inside the newly created directory, you will find couple of files and sub-directories inside it. These are the default templates for helm which are modified based on use cases for the applications.

[email protected] ~ % ls first-chart
Chart.yaml  charts  templates  values.yaml

 

Step-2: Install helm chart

In this step, we will install the chart which is created in previous step without making any changes to it. The intension here is to aware you of how the charts are installed. To do so, execute below command.

[email protected] ~ % helm install  demo --debug first-chart -f ./first-chart/values.yaml

 

helm install: This command is used to install a Helm chart onto a Kubernetes cluster.

demo: This is the name assigned to the release. Releases are Helm’s term for instances of a chart deployed on a Kubernetes cluster. The name demo identifies this particular deployment.

–debug: This flag enables debug output, providing detailed information about the installation process. It’s useful for troubleshooting and understanding the deployment steps.

first-chart: This is the name of the Helm chart to be installed. Helm will search for a chart named first-chart in its repositories or locally if it’s available.

-f ./first-chart/values.yaml: This flag specifies a YAML file (values.yaml) containing custom configuration values for the chart. Helm uses this file to override default configuration values specified within the chart’s values.yaml file. This allows for customization of the deployment parameters, such as resource limits, environment variables, and service configurations.

 

Step-3: Verify the Installation

[email protected] ~ % helm ls
NAME  NAMESPACE REVISION UPDATED                              STATUS   CHART APP          VERSION
demo  default    1       2024-03-20 14:27:17.941678 +0530 IST deployed first-chart-0.1.0  1.16.0

 

To check which all resources got create from helm install, use below command.

[email protected] ~ % kubectl get all
NAME                                           READY STATUS   RESTARTS AGE
pod/demo-first-chart-7ccd4b7f8d-89d65 1/1    Running 0        6m59s

NAME                     TYPE      CLUSTER-IP   EXTERNAL-IP PORT(S) AGE
service/demo-first-chart ClusterIP 10.96.57.41  <none> 80/TCP       6m59s
service/kubernetes       ClusterIP 10.96.0.1    <none> 443/TCP      62m

NAME                             READY UP-TO-DATE AVAILABLE AGE
deployment.apps/demo-first-chart 1/1    1          1        6m59s

NAME                                        DESIRED CURRENT READY AGE
replicaset.apps/demo-first-chart-7ccd4b7f8d 1       1       1     6m59s

 

Step-4: Uninstall Helm chart

To uninstall helm chart, use the command helm uninstall <chart-name> as shown below.

[email protected] ~ % helm uninstall flexera-calc
release "demo" uninstalled

 

Expected error

During the helm installation, I had faced below error.

Error: INSTALLATION FAILED: must either provide a name or specify –generate-name

[email protected] ~ % helm install demo --debug first-chart -f ./first-chart/values.yaml
install.go:218: [debug] Original chart version: ""
Error: INSTALLATION FAILED: must either provide a name or specify --generate-name
helm.go:84: [debug] must either provide a name or specify --generate-name

 

Solution:

When I was installing the helm chart, I ran into above issue. This issue generally occurs when we do not provide the correct absolute path of the configuration file (values.yaml) in the command. So, I provided the correct absolute path and then chart installed went through as shown below.

[email protected] ~ % helm install demo --debug first-chart -f ./first-chart/values.yaml
install.go:218: [debug] Original chart version: ""
install.go:235: [debug] CHART PATH: /Users/coder/go/src/calc/k8-artifacts/first-chart

client.go:142: [debug] creating 3 resource(s)
NAME: demo
LAST DEPLOYED: Wed Mar 20 14:27:17 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
USER-SUPPLIED VALUES:
...........................................

............................................

NOTES:
1. Get the application URL by running these commands:
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=calc-service,app.kubernetes.io/instance=flexera-calc" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT

 

Summary

We have successfully installed Helm software on MacOS using one of the method given in this tutorial. We also learnt about how Helm charts are installed and uninstalled. If you face any issue while setting up the Helm, you can refer to helm debugging guide and get help.

Leave a Comment