You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to store Helm charts for your Kubernetes applications using repositories in Azure Container Registry
4
4
ms.topic: article
5
-
ms.date: 01/28/2020
5
+
ms.date: 03/20/2020
6
6
---
7
7
8
8
# Push and pull Helm charts to an Azure container registry
9
9
10
10
To quickly manage and deploy applications for Kubernetes, you can use the [open-source Helm package manager][helm]. With Helm, application packages are defined as [charts](https://helm.sh/docs/topics/charts/), which are collected and stored in a [Helm chart repository](https://helm.sh/docs/topics/chart_repository/).
11
11
12
-
This article shows you how to host Helm charts in repositories in an Azure container registry, using either a Helm 3 or Helm 2 installation. For this example, you store an existing Helm chart from the public Helm *stable* repo. In many scenarios, you would build and upload your own charts for the applications you develop. For more information on how to build your own Helm charts, see the [Chart Template Developer's Guide][develop-helm-charts].
12
+
This article shows you how to host Helm charts repositories in an Azure container registry, using either a Helm 3 or Helm 2 installation. In many scenarios, you would build and upload your own charts for the applications you develop. For more information on how to build your own Helm charts, see the [Chart Template Developer's Guide][develop-helm-charts]. You can also store an existing Helm chart from another Helm repo.
13
13
14
14
> [!IMPORTANT]
15
15
> Support for Helm charts in Azure Container Registry is currently in preview. Previews are made available to you on the condition that you agree to the supplemental [terms of use][terms-of-use]. Some aspects of this feature may change prior to general availability (GA).
@@ -20,12 +20,12 @@ To store, manage, and install Helm charts, you use a Helm client and the Helm CL
20
20
21
21
You can use either Helm 3 or Helm 2 to host Helm charts in Azure Container Registry, with workflows specific to each version:
22
22
23
-
*[Helm 3 client](#use-the-helm-3-client) - use `helm chart` commands to manage charts in your registry as [OCI artifacts](container-registry-image-formats.md#oci-artifacts)
23
+
*[Helm 3 client](#use-the-helm-3-client) - use `helm chart` commands in the Helm CLI to manage charts in your registry as [OCI artifacts](container-registry-image-formats.md#oci-artifacts)
24
24
*[Helm 2 client](#use-the-helm-2-client) - use [az acr helm][az-acr-helm] commands in the Azure CLI to add and manage your container registry as a Helm chart repository
25
25
26
26
### Additional information
27
27
28
-
*We recommend using the Helm 3 workflow with native `helm chart` commands to manage charts as OCI artifacts.
28
+
*For most scenarios, we recommend using the Helm 3 workflow with native `helm chart` commands to manage charts as OCI artifacts.
29
29
* You can use legacy [az acr helm][az-acr-helm] Azure CLI commands and workflow with the Helm 3 client and charts. However, certain commands such as `az acr helm list` aren't compatible with Helm 3 charts.
30
30
* As of Helm 3, [az acr helm][az-acr-helm] commands are supported mainly for compatibility with the Helm 2 client and chart format. Future development of these commands isn't currently planned.
31
31
@@ -34,7 +34,7 @@ You can use either Helm 3 or Helm 2 to host Helm charts in Azure Container Regis
34
34
### Prerequisites
35
35
36
36
-**An Azure container registry** in your Azure subscription. If needed, create a registry using the [Azure portal](container-registry-get-started-portal.md) or the [Azure CLI](container-registry-get-started-azure-cli.md).
37
-
-**Helm client version 3.0.0 or later** - Run `helm version` to find your current version. For more information on how to install and upgrade Helm, see [Installing Helm][helm-install].
37
+
-**Helm client version 3.1.1 or later** - Run `helm version` to find your current version. For more information on how to install and upgrade Helm, see [Installing Helm][helm-install].
38
38
-**A Kubernetes cluster** where you will install a Helm chart. If needed, create an [Azure Kubernetes Service cluster][aks-quickstart].
39
39
-**Azure CLI version 2.0.71 or later** - Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][azure-cli-install].
40
40
@@ -43,9 +43,9 @@ You can use either Helm 3 or Helm 2 to host Helm charts in Azure Container Regis
43
43
With **Helm 3** you:
44
44
45
45
* Can create one or more Helm repositories in an Azure container registry
46
-
* Store Helm 3 charts in a registry as [OCI artifacts](container-registry-image-formats.md#oci-artifacts). Currently, Helm 3 support for OCI is considered *experimental*.
47
-
*Use `helm chart` commands directly from the Helm CLI to push, pull, and manage Helm charts in a registry
48
-
*Authenticate with your registry via the Azure CLI, which then updates your Helm client automatically with the registry URI and credentials. You don't need to manually specify this registry information, so the credentials aren't exposed in the command history.
46
+
* Store Helm 3 charts in a registry as [OCI artifacts](container-registry-image-formats.md#oci-artifacts). Currently, Helm 3 support for OCI is *experimental*.
47
+
*Authenticate with your registry using the `helm registry login` command.
48
+
*Use `helm chart` commands in the Helm CLIto push, pull, and manage Helm charts in a registry
49
49
* Use `helm install` to install charts to a Kubernetes cluster from a local repository cache.
50
50
51
51
See the following sections for examples.
@@ -58,68 +58,87 @@ Set the following environment variable to enable OCI support in the Helm 3 clien
58
58
export HELM_EXPERIMENTAL_OCI=1
59
59
```
60
60
61
-
### Pull an existing Helm package
61
+
### Create a sample chart
62
62
63
-
If you haven't already added the `stable` Helm chart repo, run the `helm repo add` command:
Pull a chart package from the `stable` repo locally. For example, create a local directory such as *~/acr-helm*, then download the existing *stable/wordpress* chart package. (This example and other commands in this article are formatted for the Bash shell.)
72
+
As a basic example, change directory to the `templates` folder and first delete the contents there:
70
73
71
74
```console
72
-
mkdir ~/acr-helm && cd ~/acr-helm
73
-
helm pull stable/wordpress --untar
75
+
rm -rf *
76
+
```
77
+
78
+
In the `templates` folder, create a file called `configmap.yaml` with the following contents:
79
+
80
+
```yml
81
+
apiVersion: v1
82
+
kind: ConfigMap
83
+
metadata:
84
+
name: hello-world-configmap
85
+
data:
86
+
myvalue: "Hello World"
74
87
```
75
88
76
-
The `helm pull stable/wordpress` command didn't specify a particular version, so the *latest* version was pulled and uncompressed in the `wordpress` subdirectory.
89
+
For more about creating and running this example, see [Getting Started](https://helm.sh/docs/chart_template_guide/getting_started/) in the Helm Docs.
77
90
78
91
### Save chart to local registry cache
79
92
80
-
Change directory to the `wordpress` subdirectory, which contains the Helm chart files. Then, run `helm chart save` to save a copy of the chart locally and also create an alias with the fully qualified name of the registry and the target repository and tag.
93
+
Change directory to the `hello-world` subdirectory. Then, run `helm chart save` to save a copy of the chart locally and also create an alias with the fully qualified name of the registry (all lowercase) and the target repository and tag.
81
94
82
-
In the following example, the registry name is *mycontainerregistry*, the target repo is *wordpress*, and the target chart tag is *latest*, but substitute values for your environment:
95
+
In the following example, the registry name is *mycontainerregistry*, the target repo is *wordpress*, and the target chart tag is *v1*, but substitute values for your environment:
83
96
84
97
```console
85
-
cd wordpress
86
-
helm chart save . wordpress:latest
87
-
helm chart save . mycontainerregistry.azurecr.io/helm/wordpress:latest
98
+
cd ..
99
+
helm chart save . hello-world:v1
100
+
helm chart save . mycontainerregistry.azurecr.io/helm/hello-world:v1
88
101
```
89
102
90
103
Run `helm chart list` to confirm you saved the charts in the local registry cache. Output is similar to:
91
104
92
105
```console
93
106
REF NAME VERSION DIGEST SIZE CREATED
94
-
wordpress:latestwordpress 8.1.0 5899db0 29.1 KiB 1 day
95
-
mycontainerregistry.azurecr.io/helm/wordpress:latestwordpress 8.1.0 5899db0 29.1 KiB 1 day
Run the `helm chart push` command in the Helm 3 CLI to push the Helm chart to a repository in your Azure containerregistry. If it doesn't exist, the repository is created.
113
+
Run the `helm registry login` command in the Helm 3 CLI to [authenticate with the registry](container-registry-authentication.md) using credentials appropriate for your scenario.
101
114
102
-
First use the Azure CLI command [az acr login][az-acr-login]to authenticate to your registry:
115
+
For example, create an Azure Active Directory [service principal with pull and push permissions](container-registry-auth-service-principalmd#create-a-service-principal) (AcrPush role) to the registry. Then supply the service principal credentials to `helm registry login`. The following example supplies the password using an environment variable:
Run the `helm chart push` command in the Helm 3 CLI to push the Helm chart to a repository in your Azure container registry. If it doesn't exist, the repository is created.
126
+
108
127
Push the chart to the fully qualified target repository:
To install a Helm chart to Kubernetes, the chart must be in the local cache. In this example, first run `helm chart remove` to remove the existing local chart named `mycontainerregistry.azurecr.io/helm/wordpress:latest`:
To work further with the chart, export it to a local directory using `helm chart export`. For example, export the chart you pulled to the `install` directory:
To view information for the exported chart in the repo, run the `helm inspect chart` command in the directory where you exported the chart.
223
+
To view information for the exported chart in the repo, run the `helm show chart` command in the directory where you exported the chart.
206
224
207
225
```console
208
226
cd install
209
-
helm inspect chart wordpress
227
+
helm show chart hello-world
210
228
```
211
229
212
-
When no version number is provided, the *latest* version is used. Helm returns detailed information about your chart, as shown in the following condensed output:
230
+
Helm returns detailed information about the latest version of your chart, as shown in the following sample output:
Run `helm install` to install the Helm chart you pulled to the local cache and exported. Specify a release name or pass the `--generate-name` parameter. For example:
243
+
Run `helm install` to install the Helm chart you pulled to the local cache and exported. Specify a release name such as *myhelmtest*, or pass the `--generate-name` parameter. For example:
247
244
248
245
```console
249
-
helm install wordpress --generate-name
246
+
helm install myhelmtest ./hello-world
250
247
```
251
248
252
-
As the installation proceeds, follow the instructions in the command output to see the WorPress URLs and credentials. You can also run the `kubectl get pods` command to see the Kubernetes resources deployed through the Helm chart:
249
+
Output after successful chart installation is similar to:
To verify the installation, run the `helm get manifest` command. The command returns the YAML data in your `configmap.yaml` template file.
261
+
262
+
Run `helm uninstall` to uninstall the chart release on your cluster:
263
+
264
+
```console
265
+
helm uninstall myhelmtest
259
266
```
260
267
261
268
### Delete a Helm chart from the repository
262
269
263
270
To delete a chart from the repository, use the [az acr repository delete][az-acr-repository-delete] command. Run the following command and confirm the operation when prompted:
264
271
265
272
```azurecli
266
-
az acr repository delete --name mycontainerregistry --image helm/wordpress:latest
273
+
az acr repository delete --name mycontainerregistry --image helm/hello-world:v1
* Configure your Azure container registry as a *single* Helm chart repository. Azure Container Registry manages the index definition as you add and remove charts to the repository.
289
+
* Authenticate with your Azure container registry via the Azure CLI, which then updates your Helm client automatically with the registry URI and credentials. You don't need to manually specify this registry information, so the credentials aren't exposed in the command histor
282
290
* Use the [az acr helm][az-acr-helm] commands in the Azure CLI to add your Azure container registry as a Helm chart repository, and to push and manage charts. These Azure CLI commands wrap Helm 2 client commands.
283
-
* Add the chart repository in your Azure container registry to your local Helm repo index, supporting chart search
284
-
* Authenticate with your Azure container registry via the Azure CLI, which then updates your Helm client automatically with the registry URI and credentials. You don't need to manually specify this registry information, so the credentials aren't exposed in the command history.
291
+
* Add the chart repository in your Azure container registry to your local Helm repo index, supporting chart search.
285
292
* Use `helm install` to install charts to a Kubernetes cluster from a local repository cache.
286
293
287
294
See the following sections for examples.
@@ -294,7 +301,7 @@ Add your Azure Container Registry Helm chart repository to your Helm client usin
294
301
az acr helm repo add --name mycontainerregistry
295
302
```
296
303
297
-
### Add a chart to the repository
304
+
### Add a sample chart to the repository
298
305
299
306
First, create a local directory at *~/acr-helm*, then download the existing *stable/wordpress* chart:
This article used an existing Helm chart from the public *stable* repository. For more information on how to create and deploy Helm charts, see [Developing Helm charts][develop-helm-charts].
440
-
441
-
Helm charts can be used as part of the container build process. For more information, see [Use Azure Container Registry Tasks][acr-tasks].
446
+
* For more information on how to create and deploy Helm charts, see [Developing Helm charts][develop-helm-charts].
447
+
* Learn more about installing applications with Helm in [Azure Kubernetes Service (AKS)](../aks/kubernetes-helm.md).
448
+
* Helm charts can be used as part of the container build process. For more information, see [Use Azure Container Registry Tasks][acr-tasks].
0 commit comments