Certified Kubernetes Application Developer (CKAD) 2021

zanise khan
8 min readNov 14, 2021

Task 2:

Create a Helm chart on any Technology learnt under Vimal Sir and
publish it on artifacthub.io

— This is the official space where helm charts are uploaded.

— This will give you good experience about how to
create and upload charts and people will give feedback as well.

— Create blog about task and share on your LinkedIN.

What we will do in this article:

  1. Installing helm in windows
  2. Create helm chart for Jenkins
  3. Install helm chart that we will create
  4. Create a simple job in Jenkins fir testing Jenkins setup
  5. Publish chart on artifact.io

Helm

Helm is the package manager of the Kubernetes. It binds all the pre-configured resources in a package of an application. With the help of it, we can install the application of the same resources in the other environment. Helm is equivalent to the YUM and apt.

It:

  • Improves productivity
  • Reduces the complexity of deployments of microservices
  • Enables the adaptation of cloud-native applications

we need Helms in other to :

Write and maintain Kubernetes YAML manifests for all the required Kubernetes objects can be a time-consuming and tedious task. For the simplest of deployments, you would need at least 3 YAML manifests with duplicated and hard-coded values. Helm simplifies this process and creates a single package that can be advertised to your cluster

Installing Helm

Helm had the client-server architecture till version 2, We have to need to install a server-side program Tiller in the Kubernetes cluster.

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(https://medium.com/r/?url=https%3A%2F%2Fgithub.com%2Fhelm%2Fhelm%2Freleases)

In windows after downloading the helm, we got a zip file,

  • 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.

To check the helm installation run the command

helm version

You’ll get the output.

Now lets create a jenkins chart

in order to do this we will need to create a folder as our workplace

  • 2. Now create a Chart.yaml inside the workspace “jenkinschart”. This file consists of the metadata about the chart. i.e. The name of the chart, Version, and app version, etc.
  • Chart.yaml file look like this

.Now lets create one more folder inside the workspace “Jenkins” Folder name will “jenkins” it contained all the YML manifest that launch our resources. Like, YML manifests for launching Deployment and for exposing the services.

lets create a chart file in the jenkins folder

  • Now lets create a chart in the folder jenkins in order to acheive this we will need to create a templates folder which will carry all our yaml files

now in the templates lets create a deployment which will not actually create a ployment instead create a deployment yaml file reason i use “dry-run”

Lets save our deployment in the templates folder and modify it a bit

Now les create our service yaml file still in the templates

for that we will need to install the deployment afterward expose it

Please make sure the “C” of Chart.yaml should be in capital letter other wise you will receive an error alert of such bellow

so now lets install the deployment by installing the chart: use the cmd bellow p> helm install <name of app> <path of the chart and templates>

C:\Windows\System32\jenkinschart>helm install jenkins jenkins/

lets expose our deployment lets also modify the yaml file of service

Now lets install the chart.yaml file

done now our helm chart is is install successfully.

now lets use the ip of minikube to browse into our newly created jenkins countainer for that lets run >minikube ip then go to a browser enter the ip plus the port number which in my case is 32409

Let’s use kubectl to pull the password from those logs.

First, return to your terminal and retrieve your Pod name:

Next, check the Pod’s logs for the admin password. Replace the highlighted section with your pod name: and you might need to scroll up or down to find the password:

Copy your_jenkins_password. Now return to your browser and paste it into the Jenkins UI.

Once you enter the password, Jenkins will prompt you to install plugins. Because you are not doing anything unusual, select Install suggested plugins.

After installation, Jenkins will load a new page and ask you to create an admin user. Fill out the fields, or skip this step by pressing the skip and continue as admin link. This will leave your username as admin and your password as your_jenkins_password.

Now we have installed and configured Jenkins on own cluster.

Publish Helm Chart on Artifacthub.io

Artifacthub 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 technologies.

Step1: Creating a package of the chart

Lets create a chart directory where we will store everything related to our chart and also this folder will go to artifacthub.io/. “$ mkdir chart1”

Artifacthub only allows archive files while uploading so the package will provide an archive file of the chart so we can publish easily.

Run the following command to create the package

$ helm package jenkins -d charts #jenkins is the chart name and charts is the dir.

To see your tar file, go to /charts directory and run the following command

Step2: Creating an index.yaml

We will have 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

helm repo index charts #<charts> you stored your pacakge in previously step

You can see the content of your index.yaml by using any text editor, I used notepad.

Step3: Pushing the charts to the GitHub repository

Create a new repository in GitHub and upload your chart source code into the GitHub repository.

lets create a repository in the github account

Now lets go to our gitbash and clone the repository

i copy and paste my chart1 folder contening my tar chart into my kubernetes-LW-task local repository. Now lets run the following cmd in other to push it to our github account

Now the folder is in our git repo

Step4: Hosting Chart using Github Pages

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.

They will provide you the URL of the root directory but we uploaded our chart in the charts directory to our Actual URL will be: https://zanise.github.io/Kubernetes-LW-task/chart1

Step5: Publishing helm chart on artifacthub

Now go to this URL artifacthub.io/ and sign in if you already have an artifacthub account or sign up for the newbie

Click on control plane then click add a repository

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 chart for you

--

--