Since starting at Zeppelin, I’ve been learning Kubernetes in detail. While there is great documentation about K8S and tons of video tutorials, I’m a practical person that wants to jump in and learn along the way.
There are multiple ways to deploy applications to Kubernetes: One is writing the necessary YAML files directly, which is easy to start with, as you can just copy-paste things out of the documentation and adapt it to your needs - but it’s hard to make those files portable for multiple clusters or easily installable without further instructions. To solve this, Helm was created by the community.
In a nutshell, Helm is both a generator for YAML files using an extended version of Go’s template engine, as well as a “package manager” to install and update the generated files in a Kubernetes cluster.
Helm allows you to install complex applications into a cluster with just a couple of commands, for example to setup an entire metrics stack with Prometheus and Grafana, which by hand could take hours:
This makes Helm look very easy to use, but I found writing own Helm charts quite challenging at first: When using the standard tool to create an “empty” project, you’ll receive a quite large and complex template, which contains files with a wild mix of YAML and go template mingled together:
It’s quite pretty to look at, but what is even going on here? Helm has the same problem as Kubernetes: The sheer complexity at first can be quite… overwhelming.
The starter template was designed to be a fully useable base for web applications, but does every application really need a Horizontal Pod Autoscaler and it’s own ServiceAccount, when apiserver access is unnecessary?
Creating the smallest possible Helm chart
Fortunately I haven’t been the first with this problem, and someone else has already created a minimal starter template. And actually, we can go even smaller.
Just from looking at the starter template, you could get the impression that a ton of boilerplate is needed. But actually, a valid helm chart can be as small as 2 lines of YAML:
Yepp, that’s all. Create a empty directory, save the above lines as
Chart.yaml and install it:
While an empty chart itself is kinda pointless, it’s a great starting point to slowly migrate your Kubernetes resource definitions to Helm, step by step (or resource by resource).
Autor Michael Mayr
letzte Änderung 11.06.2021
Lizenz Lizenziert unter CC BY-NC-SA 4.0.