Step-by-Step Guide to Hosting Your Own Helm Chart Registry on GitHub Pages

Sean Zheng
5 min readApr 17, 2024

Introduction

In the world of Kubernetes, managing and deploying applications efficiently is crucial. Helm, the package manager for Kubernetes, allows users to package configurations into charts. Hosting your own Helm chart registry can significantly streamline the deployment process. This post will guide you through setting up your own Helm chart registry using GitHub Pages, providing a free and efficient solution to share your charts.

Prerequisites

List the prerequisites needed before one can start setting up their Helm chart registry. This might include:

  • Basic knowledge of Helm and Kubernetes
  • A GitHub account
  • Helm installed on your machine

Main Content

Step 1: Create a GitHub Repository

Start by navigating directly to the “New Repository” creation page on GitHub: Create New Repository

  • Enter helm-charts as the repository name. This name helps identify the purpose of the repository at a glance.
  • Choose the “Public” option to ensure that anyone can view and use your Helm charts. This setting is ideal for sharing your work with the community and for educational purposes.

Step 2: Set Up GitHub Pages

Here’s how you can guide your readers through the process of setting up a Helm chart registry using GitHub Pages by cloning a repository, creating a branch, and configuring GitHub Pages:

Clone the Repository
Open your terminal or command prompt. Use the Git command to clone your repository:

git clone git@github.com:blackhorseya/helm-charts.git && cd helm-charts

Create and Push the gh-pagesBranch

git checkout -b gh-pages
git push origin gh-pages

Configure GitHub Pages

Visit the settings page of your repository on GitHub: [GitHub Repository Settings](https://github.com/blackhorseya/helm-charts/settings)

  • In the sidebar, navigate to Code and automation -> Pages. Under Source, select the gh-pagesbranch from the dropdown menu. You can choose to deploy from the root or the `docs/` folder, depending on how you want to organize your charts.
  • Click “Save”.

Successful Activation

Upon successful configuration, GitHub will display a message with a URL where your site is published, typically https://blackhorseya.github.io/helm-charts/

Step 3: Prepare Your Helm Charts

This step involves creating a new Helm chart within your repository. Helm charts are packages that contain all of the necessary resources to run an application, tool, or service inside a Kubernetes cluster.

mkdir -p charts
helm create charts/example

Step 4: Configure GitHub Actions Permissions

To enable GitHub Actions and set the appropriate permissions for your repository to use workflows effectively, you’ll need to configure the settings directly on GitHub. Here’s a detailed guide to walk you through the steps to set up GitHub Actions permissions for the `helm-charts` repository hosted on GitHub.

  1. Access Settings
    Open your web browser and go to your repository’s settings page by navigating to `https://github.com/blackhorseya/helm-charts/settings`.
  2. Open the Actions Settings
    In the sidebar of the repository settings, click on Code and automation and then select Actions under this section.
  3. Configure Actions and Workflow Permissions
  • Actions Permissions
    Under the General tab, you’ll find the Actions permissions section. Select Allow all actions and reusable workflows. Ensure that you click the Save button at the bottom of the page to apply the new settings.
  • Workflow Permissions
    Still under the General tab, locate the Workflow permissions section. Choose Read and write permissions. Ensure that you click the Save button at the bottom of the page to apply the new settings.

Step 5: Push to GitHub

Creating a GitHub Actions workflow in your repository can help automate the process of packaging and updating Helm charts. Here’s how to create the GitHub Actions workflow file named helm.yaml under the .github/workflows/ directory in your Helm charts repository:

name: Release Charts

on:
push:
branches:
- main

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Install Helm
uses: azure/setup-helm@v3

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
skip_existing: true
packages_with_index: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

Next, push your code to the repository and check to ensure that the GitHub Actions workflow is functioning as expected.

Step 6: Use Your Helm Chart Repository

After setting up your Helm chart repository on GitHub Pages, you can add it to your Helm installation using the following command:

helm repo add blackhorseya https://blackhorseya.github.io/helm-charts

Once added, verify that your repository is correctly set up and contains the Helm charts by using the search command:

helm search repo blackhorseya

This command will display all the Helm charts available in the blackhorseya repository, allowing you to confirm that your charts are being served as expected."

Conclusion

By now, you should have a functioning Helm chart registry hosted on GitHub Pages. This setup not only helps in managing your Kubernetes applications more efficiently but also leverages GitHub’s robust infrastructure. Experiment with different configurations, and see how you can integrate this into your CI/CD pipeline for even smoother deployments.

Reference

--

--