Setting Up Helm v2 on Windows
The Kubernetes Package Manager
Helm is a Kubernetes Package Manager designed to help you install applications on your cluster with ease. Basically, someone will create a helm software package called a Chart, and by using Helm, all you have to do is fill out a configuration yml file and Helm will install the Chart for you. You no longer have to build your own deployment files and installation strategies for operational services. Think of it like Chocolately or Snap but with Kubernetes as the OS, if that analogy makes sense.
Install Helm on Windows
You need the Helm binaries on your machine.
choco install kubernetes-helm
After installing Helm, we have to initialize it. In order to ensure we have a smooth installation, we need to check our RBAC set up for Helm.
Setting Up Helm on Kubernetes
Helm consists of Helm (Client) and Tiller (Server). Tiller gets deployed to Kubernetes and will need permissions to deploy apps.
There are a few ways to install Helm. You can give the tiller service account cluster-admin rights, deploy the tiller server service to the kube-system namespace, and call it a day. Helm will be able to install apps in any namespace.
You can also deploy tiller and to its own namespace and deploy apps restricted to that namespace only, or you can you do what I prefer, which is to install tiller into its own namespace, and then allow it to deploy to other namespaces of my choosing. In this scenario, we will do just that by creating 2 namespaces:
- airwave-tiller = this is where we will install the tiller server service
- airwave-deploy = this is where we will be deploying apps using helm
kubectl apply -f https://raw.githubusercontent.com/airwavetechio/helm/master/airwave-deploy-ns.json
kubectl apply -f https://raw.githubusercontent.com/airwavetechio/helm/master/airwave-tiller-ns.json
Now that you have the namespaces, you want to apply the proper Role and RoleBinding. You will create a service account tiller in the namespace airwave-tiller and bind it to the Role tiller-manager.
kubectl apply -f https://raw.githubusercontent.com/airwavetechio/helm/master/rbac-tiller-role.yml
Double-check the service account and verify which namespace it was applied to.
kubectl get ns
kubectl get sa
kubectl get sa -n airwave-tiller
Initialize Helm
Now that you have some customization going on, make sure you initialize Helm with the proper settings.
helm init --service-account tiller --tiller-namespace airwave-tiller --history-max 200
You can now deploy applications using Helm to your airwave-tiller namespace.
Let’s test it. First, update your helm repo and then let’s install a mysql Chart (what Helm calls a package).
helm repo update
helm install stable/mysql --namespace airwave-tiller --tiller-namespace airwave-tiller
You can verify that the pod is running by checking the output and with the name of the running pod.
Deploy to another namespace
Now that you can deploy to the airwave-tiller namespace, let’s try perform a negative test of trying to deploy mysql to the airwave-deploy namespace.
helm install stable/mysql --namespace airwave-deploy --tiller-namespace airwave-tiller
It fails because the service account tiller in the airwave-tiller namespace doesn’t have access to the namespace resource of airwave-deploy.
Let’s fix that by applying the proper role and role binding
kubectl apply -f https://raw.githubusercontent.com/airwavetechio/helm/master/rbac-deploy-role.yml
Try it again
helm install stable/mysql --namespace airwave-deploy --tiller-namespace airwave-tiller
There you have it. You can now deploy applications using Helm to various namespaces. If you have any suggestions on how I can improve this, just leave me a comment. Thanks for reading!
Clean Up
Check your Helm installations
helm ls --tiller-namespace airwave-tiller
Delete those apps
helm delete <name> --tiller-namespace airwave-tiller
Then remove all the Kubernetes changes
kubectl delete -f https://raw.githubusercontent.com/airwavetechio/helm/master/rbac-deploy-role.yml
kubectl delete -f https://raw.githubusercontent.com/airwavetechio/helm/master/rbac-tiller-role.yml
kubectl delete -f https://raw.githubusercontent.com/airwavetechio/helm/master/airwave-tiller-ns.json
kubectl delete -f https://raw.githubusercontent.com/airwavetechio/helm/master/airwave-deploy-ns.json
choco uninstall kubernetes-helm
If you want to upgrade to Helm v3, check out this article. https://medium.com/@airwavetechio/upgrading-helm-v2-to-helm-v3-on-windows-90556672fb1