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

Install Helm 3 on your client machine

curl -L https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

Here is a sample installation output:

Helm v3.0.2 is available. Changing from version v3.0.1.
Downloading https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm

Confirm installation of Helm 3

$ helm version
version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}

Step 2: Add Helm Chart repository

Once you have Helm installed, add a chart repository. We’ll add the official Helm stable charts:

$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/

"stable" has been added to your repositories

You will then be able to list the charts that can be installed:

$ helm search repo stable

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
Update Complete. ⎈ Happy Helming!⎈ 

Get chart features:

$ helm show chart stable/nginx-ingress

apiVersion: v1
appVersion: 0.26.1
description: 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'
maintainers:
- name: ChiefAlexander
- email: [email protected]
  name: taharah
name: nginx-ingress
sources:
- https://github.com/kubernetes/ingress-nginx
version: 1.26.2

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: <base64 encoded cert>
    tls.key: <base64 encoded 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.

Other guides on Kubernetes

Create Kubernetes Service / User Account and restrict it to one Namespace with RBAC

Easily Manage Multiple Kubernetes Clusters with kubectl & kubectx

How To Configure Kubernetes Dynamic Volume Provisioning With Heketi & GlusterFS

How To Deploy Lightweight Kubernetes Cluster in 5 minutes with K3s

Deploy Production Ready Kubernetes Cluster with Ansible & Kubespray