Create and Publish Helm Chart for Jenkins
What is Helm?
Helm is the first application package manager running atop Kubernetes. It allows describing the application structure through convenient helm-charts and managing it with simple commands.
It is a collection of all your versioned, per-configured application resources which can be deployed as one unit. You can then deploy another version of the chart with a different set of configurations.
What is Jenkins?
Jenkins is an open-source Continuous Integration server written in Java for orchestrating a chain of actions to achieve the Continuous Integration process in an automated fashion. Jenkins supports the complete development life cycle of software from building, testing, documenting the software, deploying, and other stages of the software development life cycle.
What are Charts?
In Kubernetes, we package all the running resources in a zip file known as the chart. A Helm chart can contain any number of Kubernetes objects, all of which are deployed as part of the chart. A Helm chart will usually contain at least a Deployment and a Service, but it can also contain an Ingress, Persistent Volume Claims, or any other Kubernetes object.
Installing Helm in windows
In version 3 helm provides more facilities i.e. install helm on the client-side only. It provides more security than version 2. We can install helm in Mac, Windows, and Linux.
The URL where you can download helm according to your operating system. link
- Extract the zip and goto folder that will come after extracting
- Copy the path and add it into the environment variable because in the command line everywhere we can do access helm.
- and check the helm in cmd with the command: helm version
Create Chart for Jenkins
- Create a new workspace or folder with the same name that you’ll give to the chart because the workspace and chart names are the same.
Now create Chart.yaml inside the workspace “Jenkins”.
- Now create one more folder inside the workspace “Jenkins” Folder name will “templates” it contained all the YML manifest that launch our resources. Like, YML manifests for launching Deployment and for exposing the services.
now create jenkins.yaml file inside the templates folder.
- Create YML manifest file for exposing the services of Jenkins. The manifest looks like this. As I already mentioned that file creates in the templates folder.
- Now we will install the chart as we create earlier using helm.
helm install <name> /path/to/the/folder
It will install your chart. After it, you found your Jenkins deployment and service has been install also.
To check run the commands:
kubectl get deploy
kubectl get svc
Now open a web browser and navigate to http://minikube ip:30000.
A page will appear asking for an administrator password and instructions on retrieving this password from the Jenkins Pod logs.
Next, check the Pod’s logs for the admin password. Replace the highlighted section with your pod name
kubectl logs <podname>
now put it in the password and install Jenkins step by step.
Publishing Helm Chart on Artifacthub.io
Artifact hub is a web-based application that helps to storing and installing helm packages. It is a public repository everyone can contribute to it by creating and publishing charts for any technology.
Run the following command to create the package
$ helm package jenkins -d charts
Creating an repo
We have to need to create an index.yaml file for every chart. it contains all the information or we can say metadata of our chart.
Now, run the following command to create index.yaml
Pushing the charts in the GitHub repository
Create a new repository in GitHub and upload charts/ source code into the GitHub repository.
Go to the settings of your Github repository and go down where you can see the GitHub Pages section.
Select master as a branch and click on save.
Publishing helm chart on artifact hub
Select the kind as Helm charts, provide a name to the repository and enter the URL to the charts provided by the GitHub pages
Click add, It will publish a chart for you..
Here it is finally added in the artifactHub.io !!
Like if you love this and share to your friends.