Friday, June 11, 2021

Deploy Azure Kubernetes Service ( AKS) with helm

 What is Helm ..

Helm is an opensource tool which help us to manage complex kubernetes applications . Also it will act as a package manager for kubernetes which help us to install,upgrade remove packages with in the kubernetes cluster. We can say helm is same as yum for Redhat linux and apt for ubundu . 

Why we have to use Helm

Writing and maintaining 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 hardcoded values. Helm simplifies this process and creates a single package that can be advertised to your cluster.

   Helm 2 is a client server model where the server called " tiller" is using to listen the requests from the helm client and pass it to the kubernetes cluster 













But in the helm 3 version the tiller component is removed and the helm client will directly communicative with the kubernetes cluster .
















Helm contains mainly three components as below 

Chart - This is  a bundle of information necessary to create the instance of a kubernetes application
Config - The config contains configuration information which can be merged with chart to create a release object
Release - This is a running instance of a chart with specific config

A helm chart structure will be as below 

YOUR-CHART-NAME/
helmignore -> includes all the files which need to be ignored on chart 
 | 
 Chart.yaml -> all the information about your chart you are packaging
 | 
 values.yaml-> all the values need to be injected to the template
 | 
 charts/ -> This is the place where we will keep other chart details which is using in the main chart
 |
 templates/ This folder is where you put the actual manifest you are deploying with the chart. 
 For example you might be deploying an nginx deployment that needs a service, configmap and  secrets.  You will have your deployment.yaml, service.yaml, config.yaml and secrets.yaml all in the template dir. They will all get their values from values.yaml from above.

Now let's configure the Azure Kubernetes cluster with helm . Below are prerequisites needed for configuration 

Azure Cli installed in the local machine and Helm also installed locally . As i am configuring using the azure cloud shell helm is installed as default .

Type helm version 
 






Installing ACR ( Azure Container Registery) 

We need to create ACR for storing the images to run the applications using helm in AKS . So let's create  ACR named as unixchipsacr using below command 

az acr create --resource-group unixchipsrg1 --name unixchipsacr1 --sku basic













Creating AKS 



Next step is we have to create the AKS and attach the ACR . I am proceeding this task using portal as i am getting some error related to quota while using the cli method . You can refer the steps on my previous blog about creating the AKS using azure portal 

http://unixchips.blogspot.com/2019/07/azure-kubernetes-service-aks.html




















To connect to this cluster using kubectl we have to get the credentials of the cluster unixchipsaks and same will be stored in /home/unixchips/.kube/config














We have to clone the application from the GIT and navigate to the application directory 










Next step is to create a docker file as below 










We have to build and push the sample application to ACR 









Now we have to create the helm chart as below  we can see webfrontend directory is created under
the GIT repository downloaded locally and we can see helm structure under that webfrontend directory

















We have to update the values.yml with the login server details of ACR which we created and change the service type as load balancer as below . We will get the login server details from the ACR portal










replicaCount: 1

image:
  repository: unixchipsacr1.azurecr.io/webfrontend
  pullPolicy: IfNotPresent
  # Overrides the image tag whose default is the chart appVersion.
  tag: ""

------------------output is omitted ---------------

service:
  type: LoadBalancer
  port: 80

*******************************************************

Install the helm chart as below 

helm install webfrontend webfrontend/










It takes a few minutes for the service to return a public IP address. Monitor progress using the kubectl get service command with the --watch argument.













If we try to access the application using external IP we can see the webpage as below 











So we have successfully configured the application using helm in AKS .

Thank you for reading and please post your comments 

1 comment:

  1. Slingo Games - Sign up now and play for real money right from your
    Slingo novcasino is one of the 토토 most popular and popular https://access777.com/ slots on the หารายได้เสริม market today. Enjoy classic, traditional slots from the comfort of your home with our 토토 사이트

    ReplyDelete