Install Helm in a Namespace

If you’re using Kubernetes you’re probably using Helm. By default Helm installs itself into the kube-system namespace. In our experiences at REVSYS, we find that can get a bit confusing with so many other things in that namespace. We like to put Helm into another separate namespace, often named tiller.

Since I’m not spinning up new clusters on a regular basis I ALWAYS forget how to do this properly and flail around in the dark for a few minutes trying to piece together the answer from blog posts and Stackoverflow.

I’m writing this post for me as much as you so I know I can find it when I need it.

Setup Helm in a namespace

We’re going to install Helm into a namespace tiller. Keep in mind you’ll need to either pass this to helm on the command line each time you use it or set export TILLER_NAMESPACE="tiller" in your environment.

The steps are fairly straight forward actually:

# Step 1: Create the namespace
$ kubectl create namespace tiller

# Step 2: Create a service account for tiller in that namespace
$ kubectl create serviceaccount --namespace tiller tiller

# Step 3: Give that service account cluster-admin access
$ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=tiller:tiller

# Step 4: Install helm
$ helm init --service-account tiller --tiller-namespace tiller

And that should do it. After the pod comes up, which can take a few seconds, you can verify your install by running:

$ helm ls
$ helm version

You should not get an error after the first command and you should see matching versions for client and server, something like this:

$ helm version
Client: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}

Hope this post helps you as much as it will help me in the future!

NOTE: With the release of Helm 3, which no longer has a tiller process, this problem should just completely go away.

Posted 10 February 2020