How to turn your Git Hub repo into a Helm Chart repo :

Helm logo
Reading Time: 3 minutes

Imagine creating a helm chart application of kubernetes but what if someone wants to access your helm-chart. As you know you can access or install helm charts present over internet on helm repositories, by using helm install. You have to first add the repo so that helm can figure out and perform its operations. By <helm repo add command>. For that you must have your helm charts deployed on helm repo, right. So in this blog you will find how we can host that particular helm chart onto a particular repo so that others who want to use that application can use it using helm command.


We can achieve the following using Github Pages.
Before we begin if you want to have a quick understanding of how helm works and its tree structure. A link to the blog is provided in the Reference section. So having said that lets begin.

A git hub repo with a helm chart will look something like this. We have a template folder in which all our applications yaml files are present. A values.yaml file which contains all the values to be passed in the form of variables. A chart.yaml file which helm will look for when we will try to package the chart and a .helmignore file telling helm which all files to ignore while building the chart. Remember: Charts should be placed under /charts directory at the top-level of directory tree.Same is seen in the image.

If we do a tree on template folders you will see all the file present inside it: nginx-deployment.yml which will deploy our pod with nginx image, nginx-service.yaml containing our nodeport service, a _helpers.tpl containing a templating logic for our deployment.

GitHub Pages :

As a second step, lets create a new branch named gh-pages so as to publish the charts. Any changes to the branch will be created automatically by the Chart Releaser Action. And we will be setting this branch in Github Pages. Go to Settings, and scroll down to the Pages section, select the branch as gh-pages and you will get the link as below: showing your site is published at this site.

GitHub Actions Workflow :

Next step will include using GitHub Actions Workflow: Chart Releaser Action to Automate GitHub Page Charts. Do the following :
Create a GitHub Actions Workflow .github/workflows/release.yml in the main branch and add the following configurations as shown in the image below link to which you can find here https://helm.sh/docs/howto/chart_releaser_action/

What this configuration will do is turn our repo to self-hosted Helm Chart repo. With every push to the main branch it will check the chart and if there is a new chart version creates a corresponding GitHub release, adds Helm chart artifacts to the release and create a index.yaml on first push or update the same afterwards with metadata about those releases, which will be then hosted on GitHub PAges.

As the last step lets push some changes and as you can see an index.yml got automatically created and lets also chage the chart version to see what happens and as you can see a new release has been created.

Lets navigate to the GitHub Action tab to see.

As you can see the index.yaml got created , updated automatically and in the bottom right side you can see new release formed.

Reference :

Link to get an understanding of what is helm : https://harness.io/blog/what-is-helm/

Link to Helm v2: Package Manager for Kubernetes : https://blog.knoldus.com/helm-v2-package-manager-for-kubernetes/

Scala Future

Written by 

I am a person who is positive about every aspect of life. I am determined, hardworking and I enjoy facing challenges.

Leave a Reply