Install existing applications with Helm

Applies to: AKS on Azure Stack HCI 22H2, AKS on Windows Server

This article describes how to configure and use Helm to install and manage Kubernetes applications in a Kubernetes cluster in AKS enabled by Azure Arc.

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 Sum, Helm is used to manage Kubernetes charts, which are packages of pre-configured Kubernetes resources.

Before you begin

Verify that you have set up the following requirements:

  • A Kubernetes cluster with at least one Linux worker node that's up and running.
  • You configured your local kubectl environment to point to your cluster. You can use the Get-AksHciCredential PowerShell command to access your cluster using kubectl.
  • Helm v3 command line and prerequisites are installed.
  • You can use Azure CLI to run commands, if you prefer this to PowerShell.

Important

Helm is intended to run on Linux nodes. If your cluster has Windows Server nodes, you must ensure that Helm pods are scheduled to run only on Linux nodes. You must also ensure that any Helm charts you install are scheduled to run on the correct nodes. The commands in this article use node selectors to make sure pods are scheduled to the correct nodes, but not all Helm charts expose a node selector. You can also use other options, such as taints, on your cluster.

Verify your version of Helm

Use the helm version command to verify you have Helm 3 installed:

helm version

The following example shows Helm version 3.5.4 installed:

version.BuildInfo{Version:"v3.5.4", GitCommit:"1b5edb69df3d3a08df77c9902dc17af864ff05d1", GitTreeState:"clean", GoVersion:"go1.15.11"}

Install an application with Helm v3

Add Helm repositories

Use the helm repo command to add the ingress-nginx repository.

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx

Find Helm charts

Helm charts are used to deploy applications into a Kubernetes cluster. To search for pre-created Helm charts, use the helm search command:

helm search repo ingress-nginx

The following condensed example output shows some of the Helm charts available for use:

NAME                            CHART VERSION   APP VERSION     DESCRIPTION                                       
ingress-nginx/ingress-nginx     3.30.0          0.46.0          Ingress controller for Kubernetes using NGINX a...

To update the list of charts, use the helm repo update command.

helm repo update

The following example shows a successful repo update:

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
Update Complete. Happy Helming!

Run Helm charts

To install charts with Helm, use the helm install command, and specify a release name and the name of the chart to install. To see a Helm chart installation in action, install a basic nginx deployment using a Helm chart.

The following command is provided twice, one for use in Azure CLI, and one for use in a PowerShell console. If you run commands in a PowerShell console, the command includes the backtick ( ` ) to allow line continuation.

helm install my-nginx-ingress ingress-nginx/ingress-nginx \
    --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
    --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux
helm install my-nginx-ingress ingress-nginx/ingress-nginx `
    --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux `
    --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux

The following condensed example output shows the deployment status of the Kubernetes resources created by the Helm chart:

>     --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
>     --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux

NAME: my-nginx-ingress
LAST DEPLOYED: Fri May 14 17:43:27 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The nginx-ingress controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace default get services -o wide -w my-nginx-ingress-ingress-nginx-controller'
...

Use the kubectl get services command to get the EXTERNAL-IP of your service:

kubectl --namespace default get services -o wide -w my-nginx-ingress-ingress-nginx-controller

For example, the command below shows the EXTERNAL-IP for the my-nginx-ingress-ingress-nginx-controller service:

NAME                                        TYPE           CLUSTER-IP   EXTERNAL-IP      PORT(S)                      AGE   SELECTOR
my-nginx-ingress-ingress-nginx-controller   LoadBalancer   10.98.53.215 <EXTERNAL-IP>    80:31553/TCP,443:30784/TCP   72s   app.kubernetes.io/component=controller,app.kubernetes.io/instance=my-nginx-ingress,app.kubernetes.io/name=ingress-nginx

List releases

To see a list of releases installed on your cluster, use the helm list command.

helm list

The following example shows the my-nginx-ingress release deployed in the previous step:

NAME                NAMESPACE    REVISION    UPDATED                                 STATUS      CHART                   APP VERSION
my-nginx-ingress    default      1           2021-05-14 17:43:27.1670709 +0000 UTC    deployed    nginx-ingress-3.30.0    0.46.0 

Clean up resources

When you deploy a Helm chart, many Kubernetes resources are created. These resources include pods, deployments, and services. To clean up these resources, use the helm uninstall command and specify your release name, as found in the previous helm list command.

helm uninstall my-nginx-ingress

The following example output shows the release named my-nginx-ingress has been uninstalled:

release "my-nginx-ingress" uninstalled

Next steps

For more information about managing Kubernetes application deployments with Helm, see the Helm documentation.