Quickstart: Develop on Azure Kubernetes Service (AKS) with Helm

Helm is an open-source packaging tool that helps you install and manage the lifecycle of Kubernetes applications. Similar to Linux package managers such as APT and Yum, Helm is used to manage Kubernetes charts, which are packages of preconfigured Kubernetes resources.

This article shows you how to use Helm to package and run an application on AKS. For more details on installing an existing application using Helm, see Install existing applications with Helm in AKS.


Create an Azure Container Registry

To use Helm to run your application in your AKS cluster, you need an Azure Container Registry to store your container images. The below example uses az acr create to create an ACR named MyHelmACR in the MyResourceGroup resource group with the Basic SKU. You should provide your own unique registry name. The registry name must be unique within Azure, and contain 5-50 alphanumeric characters. The Basic SKU is a cost-optimized entry point for development purposes that provides a balance of storage and throughput.

az group create --name MyResourceGroup --location eastus
az acr create --resource-group MyResourceGroup --name MyHelmACR --sku Basic

The output is similar to the following example. Make a note of the loginServer value for your ACR since it will be used in a later step. In the below example, myhelmacr.azurecr.io is the loginServer for MyHelmACR.

  "adminUserEnabled": false,
  "creationDate": "2019-06-11T13:35:17.998425+00:00",
  "id": "/subscriptions/<ID>/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerRegistry/registries/MyHelmACR",
  "location": "eastus",
  "loginServer": "myhelmacr.azurecr.io",
  "name": "MyHelmACR",
  "networkRuleSet": null,
  "provisioningState": "Succeeded",
  "resourceGroup": "MyResourceGroup",
  "sku": {
    "name": "Basic",
    "tier": "Basic"
  "status": null,
  "storageAccount": null,
  "tags": {},
  "type": "Microsoft.ContainerRegistry/registries"

Create an Azure Kubernetes Service cluster

Create an AKS cluster. The below command creates an AKS cluster called MyAKS and attaches MyHelmACR.

az aks create -g MyResourceGroup -n MyAKS --location eastus  --attach-acr MyHelmACR --generate-ssh-keys

Your AKS cluster needs access to your ACR to pull the container images and run them. The above command also grants the MyAKS cluster access to your MyHelmACR ACR.

Connect to your AKS cluster

To connect to the Kubernetes cluster from your local computer, you use kubectl, the Kubernetes command-line client.

If you use the Azure Cloud Shell, kubectl is already installed. You can also install it locally using the az aks install-cli command:

az aks install-cli

To configure kubectl to connect to your Kubernetes cluster, use the az aks get-credentials command. The following example gets credentials for the AKS cluster named MyAKS in the MyResourceGroup:

az aks get-credentials --resource-group MyResourceGroup --name MyAKS

Download the sample application

This quickstart uses an example Node.js application from the Azure Dev Spaces sample repository. Clone the application from GitHub and navigate to the dev-spaces/samples/nodejs/getting-started/webfrontend directory.

git clone https://github.com/Azure/dev-spaces
cd dev-spaces/samples/nodejs/getting-started/webfrontend

Create a Dockerfile

Create a new Dockerfile file using the following:

FROM node:latest

WORKDIR /webfrontend

COPY package.json ./

RUN npm install

COPY . .

CMD ["node","server.js"]

Build and push the sample application to the ACR

Use the az acr build command to build and push an image to the registry, using the preceding Dockerfile. The . at the end of the command sets the location of the Dockerfile, in this case the current directory.

az acr build --image webfrontend:v1 \
  --registry MyHelmACR \
  --file Dockerfile .

Create your Helm chart

Generate your Helm chart using the helm create command.

helm create webfrontend

Make the following updates to webfrontend/values.yaml. Substitute the loginServer of your registry that you noted in an earlier step, such as myhelmacr.azurecr.io:

  • Change image.repository to <loginServer>/webfrontend
  • Change service.type to LoadBalancer

For example:

# Default values for webfrontend.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

  repository: *myhelmacr.azurecr.io*/webfrontend
  pullPolicy: IfNotPresent
  type: LoadBalancer
  port: 80

Update appVersion to v1 in webfrontend/Chart.yaml. For example

apiVersion: v2
name: webfrontend
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: v1

Run your Helm chart

Use the helm install command to install your application using your Helm chart.

helm install webfrontend webfrontend/

It takes a few minutes for the service to return a public IP address. To monitor the progress, use the kubectl get service command with the watch parameter:

$ kubectl get service --watch

NAME                TYPE          CLUSTER-IP    EXTERNAL-IP   PORT(S)        AGE
webfrontend         LoadBalancer   <pending>     80:32150/TCP   2m
webfrontend         LoadBalancer   <EXTERNAL-IP> 80:32150/TCP   7m

Navigate to the load balancer of your application in a browser using the <EXTERNAL-IP> to see the sample application.

Delete the cluster

When the cluster is no longer needed, use the az group delete command to remove the resource group, the AKS cluster, the container registry, the container images stored there, and all related resources.

az group delete --name MyResourceGroup --yes --no-wait


When you delete the cluster, the Azure Active Directory service principal used by the AKS cluster is not removed. For steps on how to remove the service principal, see AKS service principal considerations and deletion. If you used a managed identity, the identity is managed by the platform and does not require removal.

Next steps

For more information about using Helm, see the Helm documentation.