4

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

 2 years ago
source link: https://blog.knoldus.com/how-to-turn-your-git-hub-repo-into-a-helm-charts-repo/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

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.

YcQmnaTEcYLZDl_SZYek4pqLAwh5G8O5BHFxuMkZAgvqSKzWZy-c3k5ibSZJVN846Byne375kNn9VN8XS2-LRpyR3oElM041-9ww2bWE6f5o_BtHVmZIFoC3AGNPdT61kL-gb1nm

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.

MQq88dR-yTcP2ZawJgX-7eJQDHkplOHAZJEbcuTZM6AReyrQw-2DjyKnRt0YnTh5quGPXSB6ijSx84dP3bSRw91khcP0wIkwvZl2LplO9SHhI89xnzg4WoKC1j7LeWc-iI3L23V5

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.

8eHWBEVAk7BZMLOPMITkFcY1jXthIq0B_vMtFHWZhsv8TGp0ET_mgPsSbgzaPaZvpHQqDcRwZnyDxgYbL844bDR8TLK4WkPB786Z1MQf4P6g7pnFbipL3aqQGFjtyNwCyyl5piyP

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/

pyAKNHvoONUjZjOAva01N8LAqNQPL_qz-DEJuOL_GO_boHFy60u2mBMNvH9jtWTzjB47STLYIXnRp2AQzbeKkbIrc6EHwRPLa9k1Av3AwcbzmuSUS16IpcmtOFshM5r1JRgHxtJq

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.

iNGN2HAZ8ina9WHPMQB95flaBvBOZQDz4HyUBYSKgoC6NGSxlWtvVrhbH31k7mF30wPyrp4NPNoyOH55YZ4w9qb7hyBYAssc_ryMMRx3uCin9vzbmMAom7-wGP4g33flMRnVMW5-

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.

XhY93cYdEeJYcmQnssDHQf6iYRXJE5-fEt_QlJ4CtVAausRJG2t6QtlN3F0iY3d0TJyAtS0rsmQ-jucQTGc_B3AFs83EGdFazn7Y56IhPxE1ApPL6o-YvYGb5IDTAZSkNuL99qiy

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

_5V5-QwmmEaoC2rWQ7v5CpyWUc9ZMvAymiJ2qlbeAPIDis-dbqO9Fh7QusFsFEmdH7Y36tt0eA3-vyWdqztwfO9A7U0W6PIv_k9W0wsna_fIzJHrya7pD3dSJVEiHMCI4vEq3D2X

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/

knoldus footer

Related


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK