Easily install/uninstall Helm on RBAC Kubernetes

It’s becoming more common for Kubernetes clusters to be installed with RBAC installed by default. This affects how tools like Helm (which use service-accounts to interact with kubernetes) are installed as they often need a clusterolebinding in order to have a service account with more elevated privileges.

Recently I’ve found myself doing a fair bit of Helm Chart development and often want to completely wipe and reinstall Helm from my RBAC enabled clusters.

Sick of copy/pasting Kubernetes manifests around I created a couple of really small bash functions that I can stick in my ~/.zshrc file to be loaded automatically by my zsh shell.

helmins() {
kubectl -n kube-system create serviceaccount tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account=tiller
helmdel() {
kubectl -n kube-system delete deployment tiller-deploy
kubectl delete clusterrolebinding tiller
kubectl -n kube-system delete serviceaccount tiller


Now I can simply type helmins or helmdel to install or remove helm from my RBAC enabled Kubernetes install.