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
Alternatively, you can use package managers:
For macOS (Homebrew):
brew install helm
For Linux (Snap package manager):
sudo snap install helm --classic
πΉ Installing Helm on Windows
If you have Chocolatey installed:
choco install kubernetes-helm
If you have Scoop installed:
scoop install helm
Alternatively, you can download the binary from the official Helm releases.
πΉ Verify Helm Installation
After installation, check if Helm is installed properly:
helm version
Expected output:
version.BuildInfo{Version:"v3.x.x", GitCommit:"...", GitTreeState:"clean", GoVersion:"go1.x.x"}
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
List all added repositories:
helm repo list
Update the local repository cache:
helm repo update
4οΈβ£ Searching for Helm Charts
You can search for available charts in a repository:
helm search repo bitnami
For a specific application, like Nginx:
helm search repo bitnami/nginx
5οΈβ£ Installing Applications using Helm
To deploy an application using a Helm chart, use:
helm install <release-name> <chart-name>
Example: Installing Nginx from the Bitnami repository:
helm install my-nginx bitnami/nginx
Check the installed release:
helm list
Check the status of the release:
helm status my-nginx
Verify the deployment:
kubectl get pods
6οΈβ£ Viewing and Managing Installed Applications
To view details of an installed Helm release:
helm get all my-nginx
To list all installed releases:
helm list
To upgrade an existing Helm release:
helm upgrade my-nginx bitnami/nginx
To uninstall an application:
helm uninstall my-nginx
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
πΉ 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
Then, install the chart with your custom values:
helm install my-nginx -f custom-values.yaml bitnami/nginx
8οΈβ£ Helm Rollbacks
Helm allows rolling back to a previous version:
List revision history:
helm history my-nginx
Rollback to a previous revision:
helm rollback my-nginx <revision-number>
9οΈβ£ Creating a Helm Chart (Advanced)
To create your own Helm chart:
helm create my-chart
This will generate a directory structure like:
my-chart/
βββ charts/
βββ templates/
β βββ deployment.yaml
β βββ service.yaml
β βββ _helpers.tpl
βββ values.yaml
βββ Chart.yaml
You can modify the templates/
folder to customize Kubernetes resources.
To install your custom chart:
helm install my-app ./my-chart
π Uninstalling Helm
To remove Helm completely from your system:
For Linux/macOS:
rm -rf ~/.helm
For Windows:
rm -rf $HOME\AppData\Local\helm
π 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)