Helm Charts for K8s from scratch – Part1

So, Kubernetes is everywhere, you may know… In combination with the Azure Cloud and therefore the AKS you can run your cluster in the cloud, for example. Not really new…

But on my progress to understand the K8s system, I often was wondering what exactly a helm chart is and how it could be used. This little article, divided into to parts, is a try to explain what’s needed for a chart and what it can do for you.

Part1: Start from scratch until the first K8s resource

Very short: Helm is a package manager for K8s and a chart is a collection of YAML files logically belonging together, with the option to use parameters etc. Instead of applying multiple single files (in this area resources) to the cluster, you can simply install the helm chart.

We start from scratch and create a simple example helm chart…

Prerequisites are:

  • Helm (Version 3)
  • Docker Desktop Engine (with K8s enabled in Setup)
  • A preferred code editor like VS Code or similar

Start – Minimum structure

We start with an empty folder, investigating the minimum helm chart requirements:

Run in terminal: helm show chart .

Result from terminal (all together, you only get the first detected problem):

We start resolving this issues,

+ add file Chart.yaml with following content:

name: MyChart
version: 1

Now helm is happy for the moment.

Now we check for further problems with lint:

Run helm lint:

We’ll make also lint happy through modifying Chart.yaml to

name: MyChart
version: 0.1.0
apiVersion: v1
icon : https://myfancyicon

and

+ add file values.yaml

+ add folder /templates

At this point not really with useful content, but the template is correct to install with helm. We use the dry run to only check what would be done:

helm install mychart . --dry-run --debug

Add K8s resource

Now it’s time for a first K8s object, let’s take a ConfigMap:

+ add file configmap.yaml with following content:

apiVersion: v1
kind: ConfigMap
metadata:
    name: myconfigmap
data:
    mymsg: Hello Folks

helm install mychart . --dry-run --debug

Here you can find the second part:

Helm Charts for K8s from scratch – Part2

One comment

Leave a comment

Your email address will not be published. Required fields are marked *