How to setup Helm on Digitalocean-k8s!

Step by step Helm setup on DO-K8S.


Helm is a tool that streamlines installing and managing K8s applications. Like Apt/Yum/Homebrew for K8S. Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. A single chart might be used to deploy something simple, like a memcached pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on. Click for more details.


In order to run Helm, we need the Kubernetes cluster and kubectl.

When I wrote this article, I used Digitalocean K8s (v1.12).

Also, If you already setup kubectl, you can skip this step.

Kubectl Setup

In this article, I will use Homebrew, because I am using MacOS. You can look for other operating systems setups from the official website.

Let's install kubectl (The Kubernetes command-line tool)

brew install kubernetes-cli

To test;

kubectl version

Expected output;

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.4", GitCommit:"5ca598b4ba5abb89bb773071ce452e33fb66339d", GitTreeState:"clean", BuildDate:"2018-06-18T14:14:00Z", GoVersion:"go1.9.7", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}

You should see a newer version of kubectl.

Kubectl Configuration

If you not already created a Kubernetes cluster from Digitalocean, click to create. After the initial setup, you can download your kubeconfig.yaml file from control panel.

Now, you can execute kubectl commands from your favorite terminal.

kubectl --kubeconfig="hbl-k8s-cluster-kubeconfig.yaml" get pods

If you want to get rid of --kubeconfig flag, you can merge your downloaded kubeconfig.yaml file into ~/.kube directory.

Now cristal clear;

kubectl get pods

Another mothod;

export KUBECONFIG=$HOME/Downloads/my-kubeconfig:${KUBECONFIG:-$HOME/.kube/config}

Helm Setup (Finally)

To setup helm;

brew install kubernetes-helm

In order to complete installation, we also need Tiller (Helm Server-Side Component). We can install Tiller in two different ways.

  1. First, create a service account with kubectl and then bind it as admin.
kubectl -n kube-system create serviceaccount tiller
$ kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
  1. Or, be lazy and run my gist;
kubectl apply -f

To test;

kubectl get sa -n kube-system

Expected output;

NAME                   SECRETS   AGE
csi-do-controller-sa   1         19m
csi-do-node-sa         1         19m
default                1         18m
kube-dns               1         19m
tiller                 1         49s

Helm Init

helm init --service-account tiller

Expected output;

$HELM_HOME has been configured at /Users/habilbozali/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.

Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see:
Happy Helming!

The End

We finally setup Helm, now we can deploy applications via Helm.