Creating Helm Repository Using GitHub Pages
Helm is slowly becoming a popular choice for managing Kubernetes applications. It is a Kubernetes deployment tool for packaging, automating, creating, deploying, and configuring services and applications to Kubernetes clusters. Helm simplifies application deployments on Kubernetes, not only because it facilitates the application release phase but also because Helm makes it possible to manage variables in the Kubernetes manifest YAML files easily. GitHub is a popular resource among developers where they share code and work together on open-source projects. This online software development platform can store, track, and help collaborate on software projects quickly and efficiently.
Before we go ahead, we also need to know the term — Helm charts. Helm uses a format for packaging called Helm charts. Helm charts contain files that help you upgrade, define, or install Kubernetes applications. Once the charts are ready to share, the most straightforward step is to upload them to a chart repository. A Helm chart repository allows us to host and share Helm packages. For this, any HTTP server will do. Unfortunately, Helm doesn’t include a native tool to upload charts to a remote chart repository server. And this is precisely why we use GitHub Pages to share our charts.
GitHub Pages use-case:
GitHub is an exciting choice to host your personal, organizational, and project sites. With GitHub Pages, you can quickly create a site from your GitHub repositories — a great way to share static content related to your repositories like apps, portfolios, and project blogs. Read more on GitHub Pages here.
Before we begin creating the Helm Repository Using GitHub, you must know how to create a branch on GitHub, commit changes using Git, and understand Helm charts.
Let’s start with creating a public Helm chart repository.
Step 1: Create a folder and a GitHub repository
Create a folder and a GitHub repository using the following command:
mkdir public-Helm-charts && cd public-Helm-charts
Create a Public GitHub repository.
Step 2: Clone the GitHub repository
Clone your GitHub repository in this folder:
git clone <github_repository_path>
Here, my GitHub repository name is my-helm-charts
I will be creating a charts folder and placing my Helm charts in this folder (This is optional)
mkdir charts && cd charts
As shown in the above image, create a Helm chart or copy your existing app/service Helm chart inside the charts folder.
Here you can store multiple charts. For now, I will create a public Helm chart repository with a single Helm chart, as shown in the above image.
Use the helm lint command to test the Helm chart locally:
helm lint <path_to_helm_chart_dir>
Step 3: Add robots.txt at the root location of the repository
This will avoid bot crawling on the Helm repository.
echo -e “User-Agent: *\nDisallow: /” > robots.txt
Step 4: Package your Helm chart
You need to create a .tgz file of Helm chart at root location and to do so use the following command:
Helm package charts/observability-service/
Step 5: Finally, create the index.yaml file for the Helm repository
Use the following command to create the index.yaml file:
Helm repo index — url <github_repository_path> .
Note: If you make any further changes in the Helm chart, you must regenerate the index.yaml file and the .tgz file with the latest changes as mentioned in Steps 5 and 6.
However, you can use — merge flag to add new charts to an existing index incrementally.yaml… Read more