DEV Community

skumaraz2k7
skumaraz2k7

Posted on • Updated on

Helm Charts in Azure Container Registry

Table of Contents:

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

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

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

Image description

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

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

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

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

Image description

Image description

Image description

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

Check the portal to confirm the charts are pushed correctly.

Image description

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

Top comments (0)