Create your own Helm Chart Repository using GitHub Pages

Recently I have been going through this awesome package manager for Kubernetes called Helm. Its a great tool for managing the Kubernetes manifests whenever we are dealing with a large number of microservices. What Helm does is, it groups all the Kubernetes manifests required for a microservice into a folder/chart. And then it helps us manage the lifecycle of the chart. Thus abstracting the multiple Kubernetes manifests associated with a single microservice from the developers.

Similar to the very popular Docker hub, Helm also has a publicly accessible Helm hub. Anybody can download charts from the Helm hub and use them, just like we do with Docker hub. There are many other publicly accessible Helm Chart Repositories too, either managed by big organisations or the open source community. But it’s always great to have a custom repository that we can use as our own Helm Chart Repository. It helps us share our charts with friends and peers by just sharing the link to the Helm Chart Repository. So, that whenever we update our charts or add new charts, interested folks can access them by just updating the chart repository in their local machines using helm repo update .

Let’s now look at the steps involved in creating our own Helm Chart Repository :

  • Chart Repository : A chart repository is just an HTTP server that houses an index.yaml file and our packaged charts. So, we have plenty of options to host our chart repository, we can either use Cloud Object Storage or GitHub Pages or JFrog Artifactory or our own web server. We just need to serve some static content that’s it. Here we are using the GitHub Pages approach.
  • Create GitHub repo : The first thing is to create a new GitHub repo and then just for following the conventions, lets have a separate branch called gh-pages. All our static content will go into this branch.
  • Update GitHub repo settings : Now, we need to update the settings of the repo to configure the GitHub page. The Source of the GitHub page should be pointing to the gh-pages branch and should be serving the /root dir. We can also find our GitHub page URL from this settings section itself. This would be our chart repository URL.
  • Git clone : Let’s clone the repo to our local machine.
  • Helm package : Package the helm chart that we want to upload to our repo.

Note : if we don’t have a helm chart ready, we can just create a sample one using helm create my-chart . I have a helm chart named webapp ready with me, so I’m using it.

  • Create a new folder and copy the packaged chart into it.
  • Chart repo index creation : Next we have to create the index.yaml file. A valid chart repository must have an index file. The index file contains information about each chart in the chart repository.

Note : The helm repo index command will generate an index file based on the given local directory that contains the packaged charts.

  • Git push : Copy or move the index.yaml and the packaged charts to the local GitHub repo, git add, commit and push them to the remote.
  • That’s it, we have successfully pushed a chart to our chart repository. Let’s now add this new repository to our local Helm CLI and install the Helm chart in it to our cluster.

Note : helm always uses the current kubectl context, so before doing helm install we have to make sure that our kubectl context is set to the desired cluster.

Adding the custom chart repo to helm CLI

List all chart repos to verify the addition

Search for the chart

Install the chart to a cluster

For more information its always great to follow https://helm.sh/.

Engineer

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