Publish your own Helm chart using GitHub Pages

Helm is a package manager for Kubernetes (think apt or yum). It works by combining several manifests into a single package that is called a chart. Helm also supports chart storage in remote or local Helm repositories that function like package registries such as Maven Central, Ruby Gems, npm registry, etc.

Let’s assume you want to develop a Helm chart and publish it for others to consume. For example, I want to create a Helm chart for deploying Kafka using the Strimzi kafka operator and also create a Kafka topic as part of the Kafka deployment. Strimzi provides container images and Operators for running Kafka on Kubernetes.

Create a GitHub repository for publishing the Helm charts

Create a new repository with README.md on GitHub.

git clone https://github.com/surenraju/kafka-helmcd kafka-helm

Make sure that master branch of the repository is published on GitHub Pages. In the settings section of your git repository, scroll down to Pages section and configure it as follow:

Create a helm chart from scratch (or copy your own)

As a pre-requisite, you need to have the Helm CLI installed and initialized. Please find here the instructions in case you haven’t install Helm client yet.

helm create kafka

# Push the change
git add *
git commit -m 'Adding charts'
git push origin master

Now your repository looks like:

/README.md
/kafka/Chart.yaml
/kafka/templates
/kafka/templates/NOTES.txt
/kafka/templates/_helpers.tpl
/kafka/templates/deployment.yaml
/kafka/templates/ingress.yaml
/kafka/templates/service.yaml
/kafka/values.yaml

I have edited the generated helm default configuration to deploy Strimzi kafka operator and also to deploy a Kafka topic. Refer my git repository for the code.

https://github.com/surenraju/kafka-helm.git

Lint the chart

As a good habit, helm lint runs a series of tests to verify that
the chart is well-formed:

$ helm lint kafka

Create the Helm chart package

$ helm package kafkaSuccessfully packaged chart and saved it to: /Users/surenraju/github/kafka-helm/kafka-0.1.0.tgz

Create the Helm chart repository index

According to Helm:

A repository is characterized primarily by the presence of a special file called index.yaml that has a list of all of the packages supplied by the repository, together with metadata that allows retrieving and verifying those packages.

So, follow below the commands to create is the index.yaml file

$ helm repo index --url https://surenraju.github.io/kafka-helm .$ cat index.yamlapiVersion: v1
entries:
kafka:
- apiVersion: v2
appVersion: 0.22.1
created: "2021-06-05T10:15:59.965459+04:00"
dependencies:
- condition: strimzi.enabled
name: strimzi-kafka-operator
repository: https://strimzi.io/charts
version: 0.23.0
description: A Helm chart for Kafka deployment using on strimzi-kafka-operator
digest: bcee5836b6e8edfca5fc893e9dfa9631a716fd09b39a991f29b84294e4188cea
name: kafka
type: application
urls:
- https://surenraju.github.io/kafka-helm/kafka-0.1.0.tgz
version: 0.1.0

Push the changes to GitHub

$ git add *$ git commit -a -m “Adding helm charts for Kafka”$ git push origin master

Configure Helm CLI

In order to use the newly created Helm chart, we need to configure the Helm client.

$ helm repo add kafka https://surenraju.github.io/kafka-helm"kafka" has been added to your repositories

Test the Helm chart

$ helm search repo kafkaNAME        CHART VERSION APP VERSION DESCRIPTION
kafka/kafka 0.1.0 0.22.1 A Helm chart for Kafka deployment using on stri...

Install Kafka using our Helm chart

Following step requires kubectlconfigured and a working kubernetes cluster with some default storage class.

$ kubectl create namespace kafka
$ helm install kafka kafka/kafka --namespace=kafka
NAME: kafka
LAST DEPLOYED: Sat Jun 5 06:32:36 2021
NAMESPACE: kafka
STATUS: deployed
REVISION: 1
TEST SUITE: None
--------------------------------------------------------------------
SUCCESS: helm install --namespace=kafka --timeout=10m0s --values=/home/shell/helm/values-kafka-0.1.0.yaml --version=0.1.0 --wait=true kafka /home/shell/helm/kafka-0.1.0.tgz
--------------------------------------------------------------------
$ kubectl get po -n kafkaNAME READY STATUS RESTARTS AGEkafka-kafka-0 0/1 Running 0 34skafka-kafka-1 0/1 Running 0 34skafka-kafka-2 0/1 Running 0 34skafka-zookeeper-0 1/1 Running 0 73skafka-zookeeper-1 1/1 Running 0 73skafka-zookeeper-2 1/1 Running 0 73sstrimzi-cluster-operator-cbb97bb58-2j5j6 1/1 Running 0 83s

Site Reliability Engineer linkedin.com/in/surenraju/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store