Azure Kubernetes Service (AKS) with HELM

Jonathan
7 min readOct 28, 2021

It has been a while since I last posted anything on Medium. Recently, I have learned a little more about HELM. I want to share this with all that are still learning and also to have a place to look back after some time.

HELM literally means the steering wheel of ships or boats. If we think of Kubernetes as the orchestrator of multiple containers (workload/application) on ships (underlying virtual machine clusters), it is not hard to understand why the project picked HELM as the name. It is because HELM could contain all the content needed for the containers to work as instructed. In a way, you could say HELM is the orchestrator of the orchestrator (Kubernetes).

In HELM official documentation, this sentence is being marked and I personally think that is soul of HELM. For understanding more on “charts” and “releases”, check this site.

Helm installs charts into Kubernetes, creating a new release for each installation. And to find new charts, you can search Helm chart repositories.

HELM Installation

HELM installation is quite straightforward. No matter you have installed it before in your OS or not in the past, just uninstall everything related to HELM to make sure. The folders containing HELM-related data varies, so check this site to know the details.

Go to this site to find the desired version of HELM you would like to install and follow the steps below if you are running on Linux machines.

# getting the latest version of HELM
wget https://get.helm.sh/helm-v3.7.1-linux-amd64.tar.gz
# unzip the downloaded compressed files
tar -zxvf helm-v3.7.1-linux-amd64.tar.gz
# mv the decompressed files to /usr/bin/helm
sudo mv linux-amd64/helm /usr/bin/helm
# check HELM version
helm version

Ideally, HELM version should show in the console if all steps were performed successfully.

HELM Chart Create

Let’s create a simple HELM chart to be more familiar with the basic concepts. The name value in Chart.yaml would be seen in packages.

The value in “nameOverride” would be shown in the actual chart name.

Follow through the section “Create Helm Chart” on this site and use “LoadBalancer” instead of “NodePort” in Step5 to let external users to contact test the service.

Create a namespace specifically for this HELM chart deployment. Check out this site for reference.

# create the namespace for the HELM chart
kubectl create ns secondhelmchart
# deploy the HELM chart in the namespace
helm install --namespace firsthelmrchart firsthelmrelease firsthelmchart/ --values firsthelmchart/values.yaml
# check what parameters could be added after "helm install"
helm install -h

Verify all the resource were deployed successfully.

HELM Chart Upgrade

Users could modify some of the values within YAML files and perform an upgrade on the spot. For example, adding the environment variable within the file “values.yaml” and making use of it in “deployment.yaml”.

# adding environment varisbles in values.yaml
env:
— name: service_name
value: ‘NGINX-BACKEND’
# making use of the environment variables in templates/deployment.yaml
env:
{{- toYaml .Values.env | nindent 12 }}
# upgrade the current installation with
helm upgrade <release name you had> .

HELM Upgrade with Packaging

HELM chart could be packaged in a compressed file.

# ensure the current directory is in the chart directory
cd <helm chart directory>
# package the chart
helm package .
# list the compressed package
ls

For demonstration purpose, we would make some changes in “values.yaml” and head to “Chart.yaml” to change the chart version from 0.1.0 to 0.2.0.

Now, let’s package the chart again and you would notice the package naming convention changed from 0.1.0 to 0.2.0.

Let’s upgrade our chart to the latest package.

# upgrade the current chart
helm upgrade <current release name> <new package name>
# check the package
helm list

HELM Release Rollback

If the latest upgrade is not working, the release could be rolled back.

# check the current HELM chart version
helm list
# rollback the latest HELM release. This should show in "REVISION". The previous upgrade was revision 2 and now rollback as revision 3.
helm rollback <release name> 1
# check the current HELM chart version
helm list

Deploy HELM Chart with Different Release

# search for a chart in all the repositories
helm search repo <keyword>
# install the release from the repository/chart
helm install --namespace <namespace name, but this is optional> <release name> <repository name>/<chart name>
# check the release
helm list --all-namespaces

Upload HELM Chart to Local Repository

We assume you have already initialize in the folder of the HELM chart. If not, please initialize it with

cd <HELM chart directory> && git init.

After making changes in the GitHub Page as below, please commit and push all the YAML files to the GitHub.

# make an index.yaml for the GitHub page
helm repo index --url https://<GitHub name>.github.io/<GitHub project name>/ .
# commit the files and push
git add * && git commit -m "first commit" && git push
# check HELM local repository
helm repo list
# add GitHub page link as the HELM local repository URL
helm repo add <repo name> https://<GitHub name>.github.io/<GitHub project name>/
# search within HELM local repository
helm search repo <keyword>

Upload HELM Chart to Azure Container Registry (ACR)

After having the HELM chart package, users would need to authenticate to get access to ACR. Then, users should push the HELM chart package to ACR as OCI artifact. Lastly, the HELM chart could be checked in the repository with AZ CLI commands.

# prerequisite steps
export HELM_EXPERIMENTAL_OCI=1
# login to ACR HELM Repo
helm registry login <ACR full URL> --username xxx --password xxx
# push HELM chart to ACR HELM repo
helm push <HELM chart package> oci://<ACR full URL>/helm
# check whether the HELM chart is in ACR HELM repo
az acr repository show -n <ACR name> --repository helm/<HELM chart name>

For more information, check this site.

Search HELM Repository

Local

Repository is the place that stores all HELM charts. Users could search the chart from the HELM hub (publicly accessible) or local (adding repository URLs into the local searching paths).

# add repo URLs to local searching paths
helm repo add stable https://charts.helm.sh/stable
# check the local searching path to see whether the URLs is showing
helm repo list
# try to find a chart within the added repositories
helm search repo <chart name>

HELM Hub

# search the chart on HELM Hub
helm search hub nginx

For more information on on HELM functionalities, please check this site.

This would provide a general idea on how to perform the basic operations around HELM. Happy learning!

--

--

Jonathan

Started my career as a consultant, moved to support engineer, service engineer and now a product manager. Trying to be a better PM systematically every day.