Helm Charts in Azure Container Registry
Tags: helm, kubernetes, azure, acr
Published: 2023-10-15 18:46:20

**Table of Contents:**

-  [Introduction](#1-introduction)
-  [Prerequisites](#2-prerequisites)
-  [Setting Up Helm for Private Registry](#3-setting-up-helm-for-private-registry)
-  [Pushing Helm Charts to a Private Registry](#5-pushing-helm-charts-to-a-private-registry)
-  [What Next](#9-what-next)

**1. Introduction**

In this article, you will discover the power of Helm charts in Azure Container Registry (ACR). This post guides you through the seamless integration of Helm, enabling secure and scalable management of Helm charts within ACR, elevating your Kubernetes deployments on Azure to the next level.

**2. Prerequisites**

- Azure Subscription
- Azure Container Registry (ACR)
- Helm Client (Version > 3.0)
- Basic knowledge of Docker, Azure, and Container Registry

**3. Setting Up Helm for Private Registry**

If you don't have a Helm client, please follow the instructions [here](https://helm.sh/docs/intro/install/) according to your OS.
I am using helm on macos, but you can use any supported OS.

Make sure you are using Helm version > 3.0

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/23z9x8o93g59p8yeqr4r.png)

Create Helm Chart as below:


`helm create myapp`

This will initialise local helm charts. As a result two folders, chart and templates along with two files Chart.yaml and values.yaml are created as below:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6r4vstsdodywih3kqci.png)

To keep the chart simple, remove all files from templates folder.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6lmvlkbcioys0uosmxe.png)

Create deployment.yaml and service.yaml file inside templates folder using below commands

`
cat <<EOF > deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-deployment
  labels:
    app: myapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
EOF
`

`
cat <<EOF > service.yaml
apiVersion: v1
kind: Service
metadata:
  name: myapp-service
spec:
  selector:
    app: myapp
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
EOF
`

Packaging the chart to local archive
change directory to myapp and run below command:
`helm package .`


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/blpp0ogx0ntcka6k7gye.png)

**4. Pushing Helm Charts to a Private Registry**

Make sure you have a container registry in your azure subscription with pull and push permission.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ch1qrg70jf0qugyhikgz.png)

First authenticate to container registry as below:
helm registry login <acr> --username xxx --password xxx

I am using a service principal (app registration) which has acrpull and acrpush permission on the repo.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1ortsaajzyrt9ewsrev.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90wp41zgdzouwn3xgxiu.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dkom2xzcl6ru8ql4hjbr.png)

Now push helm chart to container registry as OCI artifact as below:
`helm push myapp-0.1.0.tgz oci://skazacr.azurecr.io/helm`

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/moso4xy7htffk1ya6rfg.png)

Check the portal to confirm the charts are pushed correctly.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fb8xt717qjbeowcw7il5.png)

**5. What Next**

This was a simple demonstration on how to use private registry for helm charts. In the next article I will show you how to deploy and upgrade the helm chart from private container registry.


**Author Bio**

As a dedicated Kubernetes enthusiast, I am on a continuous journey to harness the full potential of container orchestration. With certifications in both Certified Kubernetes Administrator (CKA) and Certified Kubernetes Application Developer (CKAD), I bring hands-on expertise to the table. I believe in the philosophy of learning Kubernetes every day, staying at the forefront of this dynamic technology, and sharing my insights with the community. Join me in exploring the ever-evolving world of Kubernetes and containerization. 
Follow me on LinkedIn - [www.linkedin.com/in/sandeep-kumar-60049b16](url)