100% found this document useful (1 vote)
533 views10 pages

Helm Charts

This document discusses how to build a first Helm chart using Super Mario as an example of microservices. It covers installing Helm, creating a Helm chart for a Spring Boot application, modifying the chart configuration files, and testing, installing, upgrading, rolling back, and deleting the Helm release. The key steps are: 1. Install Helm using various package managers or by downloading binaries 2. Create a Helm chart for a Spring Boot app using `helm create` 3. Modify the `Chart.yaml`, `values.yaml`, `deployment.yaml`, and `service.yaml` files 4. Test the chart template with `helm template` and lint with `helm lint`
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
533 views10 pages

Helm Charts

This document discusses how to build a first Helm chart using Super Mario as an example of microservices. It covers installing Helm, creating a Helm chart for a Spring Boot application, modifying the chart configuration files, and testing, installing, upgrading, rolling back, and deleting the Helm release. The key steps are: 1. Install Helm using various package managers or by downloading binaries 2. Create a Helm chart for a Spring Boot app using `helm create` 3. Modify the `Chart.yaml`, `values.yaml`, `deployment.yaml`, and `service.yaml` files 4. Test the chart template with `helm template` and lint with `helm lint`
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Building first Helm Chart with Super

Mario as Microservices
When someone talks about managing the kubernetes cluster then I can very
much assume that a particular someone is running a lot
of kubectl, kubeadm command on terminal and which is quite obvious because
managing kubernetes cluster is not as easy as it seems to be.
Managing kubernets cluster means checking cluster, pods, nodes, application
deployment, replicas, load-balancer and the list goes one. So the question which
arises in my mind -
Is there an easy way to manage this or at least some part of it?
The answer is Yes and its Helm Chart.

1. How to Install Helm Chart?


Installing Helm is fairly easy and there are various package manager available
for you -
Homebrew
brew install helm

Chocolatey
choco install kubernetes-helm

Scoop
scoop install helm

GoFish
gofish install helm

Snap
sudo snap install helm –classic

Binary (My Favourite)


If you do not like any of the above packager manager then you could download
the binaries as well
• Get the Binary - Download Binary
• Unpack it using - tar -zxvf helm-vxxx-xxxx-xxxx.tar.gz
• Move it - mv linux-amd64/helm /usr/local/bin/helm
Using Script(For my friends who loves scripting)
curl -fsSL -o get_helm.sh
https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

Verify Helm Chart Installation

Let's create Our First Helm Chart


Before we create a our First Helm Chart, we need to have kubernetes cluster up
and running. Use the following command to verify the status of kubernetes
cluster –

Lets run some Helm Commands for creating our first Helm Chart
helm create supermario
Helm Chart Structure

Chart.yaml

This file contains all the metadata about our Helm Chart for example –

You do not need to define each configuration here but you must need to define -
1. apiVersion
2. name
3. version
Other configurations are optional
Versioning - Each chart should has its own version number and it should follow
the Semantic Versioning 2.0 aka SemVer 2. But do not get confuse with
apiVersion, there are no strict rules for apiVersion.
values.yaml
As the name suggests we have do something with the values and yes you are
right about it. This configuration file holds values for the configuration.
Do not worry it is fairly simple to understand once you look at the
following values.yaml

It looks quite enormous but trust me you do not need to write or remember every
configuration by heart. Helm Create command generates the bare minimum
values.yaml for you.
Since in this example we are going to try our Helm Chart for super mario
application, lets go through the configuration which we need to modify for
deploying our spring boot application.
1. repository : image:repository: kaminskpavel/mario
2. port: 8080
3. type of service
So in the whole values.yaml you need to update the configuration at two
places repository and port

Alright now we are ready with our Chart.yaml and values.yaml, lets jump to next
configuration yamls

deployment.yaml
The next configuration we need to update is deployment.yaml and as the name
suggest it is used for deployment purpose. So lets see how does it looks like

As our image is not having any tag so just remove highlighted from image
variable and also update container port as per your application:-

service.yaml
The service.yaml is basically used for exposing our kubernetes springboot
deployment as service. The good thing over here we do not need to update any
configuration here. I just update name in ports value and reference to nodeport:-
Run $ helm template springboot
Now we are into the step no 4 and we are pretty much ready with our first Helm
Chart for our spring boot application.
But wait - Wouldn't it be nice if you could see the service.yaml, deployment.yaml
with its actual values before running the helm install command?
Yes you can do that with the helm template command -

I love this command because it locally renders the templates by replacing all the
placeholders with its actual values.
There is one more sanitary command lint provided by helm which you could run
to identify possible issues forehand.
As you can see the command output 1 chart(s) linted, 0 chart(s) failed. So
there is no failure and you are good to go.

helm -debug -dry-run


The next check which we are going to do is -dry-run. Helm is full of such useful
utility which allows developer to test its configuration before running the final
install command
Use the following -dry-run command to verify your Super Mario Helm Chart

helm install supermario --debug --dry-run supermario

If there is something wrong with your Helm chart configuration then it will going to
prompt you immediately.

helm install
Alright lets run the install command.
helm install supermario supermario
Use the following list command to list down all the releases –
helm list -a

Upgrade helm release


There is one more feature of Helm Chart which is helm upgrade. It makes it
easy for devops to release the new version of application.
Lets take the same myfirstspringboot release and update
its replicaCount from 1 to 2
But before we need to update the replicaCount. First we need to udpate the
version in Chart.yaml from 0.1.0 to 0.1.1
Okay now we are done with the update and ready to make our new release
upgrade. Use the following command –
helm upgrade supermario .

Rollback Helm release


In the Step 8 we upgraded the Helm chart release from version 1 to version 2.
So let's see one more rollback feature of Helm Chart.

helm rollback supermario 1


Delete Helm release
Wouldn't it be nice if you need to run only one command to delete your Helm
release and you do not have to do anything else.
helm delete supermario

You might also like