Welcome to today’s guide on how to install and use Helm 3 in your Kubernetes environment. Helm is the ultimate package manager for Kubernetes. It helps you manage Kubernetes applications by using Helm Charts – With it you can define, install, and upgrade basic to the most complex Kubernetes applications alike.
Helm 3 doesn’t have the server/client architecture like Helm 2. There is no tiller server component. So the installation is just for the helm command line component which interacts with Kubernetes through your kubectl configuration file and the default Kubernetes RBAC.
For Helm 2, checkout: Install and Use Helm 2 on Kubernetes Cluster
Step 1: Install Helm 3 on Linux | macOS
Download Helm 3 installation script.
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
Give the script execute permissions.
chmod 700 get_helm.sh
Run the installer.
sudo ./get_helm.sh
Here is a sample installation output:
Downloading https://get.helm.sh/helm-v3.7.1-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm
Confirm installation of Helm 3
$ helm version
version.BuildInfoVersion:"v3.7.1", GitCommit:"1d11fcb5d3f3bf00dbe6fe31b8412839a96b3dc4", GitTreeState:"clean", GoVersion:"go1.16.9"
Step 2: Add Helm Chart repository
Once you have Helm installed, add a chart repository. Add official charts repository:
$ helm repo add stable https://charts.helm.sh/stable
"stable" has been added to your repositories
In this example we’ll add bitnami repository:
$ helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories
You will then be able to list the charts that can be installed:
$ helm search repo stable
Listing charts in the bitnami repository:
$ helm search repo bitnami
Step 3: Install Applications on Helm Chart
Confirm that your Kubernetes CLI is using the right cluster context by first listing the available contexts.
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* k3s k3s k3s-admin kube-system
prod prod prod-admin
Switch to desired context:
$ kubectl config use-context k3s
Switched to context "k3s".
We will confirm if we can use Helm 3 to install applications on our Kubernetes cluster. In this setup, I’ll install Nginx ingress controller. NGINX Ingress controller can be easily installed from official Helm chart stable/nginx-ingress repository.
$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
Get chart features:
$ helm show chart stable/nginx-ingress
apiVersion: v1
appVersion: v0.34.1
deprecated: true
description: DEPRECATED! An nginx Ingress controller that uses ConfigMap to store
the nginx configuration.
home: https://github.com/kubernetes/ingress-nginx
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Nginx_logo.svg/500px-Nginx_logo.svg.png
keywords:
- ingress
- nginx
kubeVersion: '>=1.10.0-0'
name: nginx-ingress
sources:
- https://github.com/kubernetes/ingress-nginx
version: 1.41.3
Install the chart using the helm install command.
$ helm install nginx-ingress stable/nginx-ingress
You can as well let the installer generate the name of your chart release (omits the NAME parameter). You will be greeted with a message like below after the installation.
NAME: nginx-ingress
LAST DEPLOYED: Mon Dec 16 00:08:12 2019
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace kube-system get services -o wide -w nginx-ingress-controller'
An example Ingress that makes use of the controller:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
namespace: foo
spec:
rules:
- host: www.example.com
http:
paths:
- backend:
serviceName: exampleService
servicePort: 80
path: /
# This section is only required if TLS is to be enabled for the Ingress
tls:
- hosts:
- www.example.com
secretName: example-tls
If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:
apiVersion: v1
kind: Secret
metadata:
name: example-tls
namespace: foo
data:
tls.crt:
tls.key:
type: kubernetes.io/tls
Confirm installation:
$ helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
nginx-ingress kube-system 1 2019-12-16 00:08:12.513438985 +0300 EAT deployed nginx-ingress-1.26.2 0.26.1
To uninstall a release, use the helm uninstall
command:
$ helm uninstall nginx-ingress
release "nginx-ingress" uninstalled
$ helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
Below example if for the installation of DokuWiki on Kubernetes using Helm.
$ helm install dokuwiki stable/dokuwiki
NAME: dokuwiki
LAST DEPLOYED: Mon Dec 23 13:32:52 2019
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **
1. Get the DokuWiki URL by running:
** Please ensure an external IP is associated to the dokuwiki service before proceeding **
** Watch the status using: kubectl get svc --namespace kube-system -w dokuwiki **
export SERVICE_IP=$(kubectl get svc --namespace kube-system dokuwiki --template " range (index .status.loadBalancer.ingress 0) . end ")
echo "URL: http://$SERVICE_IP/"
2. Login with the following credentials
echo Username: user
echo Password: $(kubectl get secret --namespace kube-system dokuwiki -o jsonpath=".data.dokuwiki-password" | base64 --decode)
Enjoy using Helm to manage Applications lifecycle in your Kubernetes environment.