With the Helm chart feature, Container Registry Enterprise Edition helps you effectively manage and distribute various Kubernetes resources. You can push and pull charts only after installing and configuring Helm and configuring a Container Registry Enterprise Edition instance.

Background information

Kubernetes provides a unified API, which allows you to define Kubernetes resources in YAML format. Kubernetes has various types of resources, such as deployments, StatefulSets, and ConfigMaps.

As the YAML-based software delivery system is continuously improved, the Cloud Native Computing Foundation (CNCF) community has developed charts and its implementation tool Helm to manage resources at a higher level.

  • A chart is a collection of files that describe a related set of Kubernetes resources. For example, a chart can be a collection of files that describe WordPress and MySQL resources, or a collection of resource description files for an etcd cluster.
  • Helm is a command-line program used to manage charts and their releases.

Container Registry Enterprise Edition supports managing Helm charts of V2 and V3. The Helm chart feature helps you manage your cloud-native assets with ease. On the Overview page of a Container Registry Enterprise Edition instance, turn on Charts in the Components Configuration section to enable the Charts component. After the status of the component changes to Running, you can start to manage a Helm chart repository.

Turn on Charts

Install and configure Helm

  1. Download Helm of the required version from the official website.
    Note Make sure that the Helm version is V2 or V3. You can run the helm version -c command to check the version. The following command uses V2.14.2 as an example.
    # Decompress the downloaded package.
    tar -zxvf helm-v2.14.2-linux-amd64.tgz
    # Move the decompressed file to the specified directory.
    mv linux-amd64/helm /usr/local/bin/helm                    
  2. Instal the Helm plug-in.
    Note You need to install git before installing the Helm plug-in.
    # Install the Helm plug-in. Make sure that Git is installed in advance.
    helm plugin install https://github.com/AliyunContainerService/helm-acr
    # Initialize Helm.
    # 1. If Helm is installed on a node of a Container Service for Kubernetes cluster, the tiller has been initialized by default. You only need to initialize the client. If you do not want to access Google charts, add the skip-refresh option to the init command.
    helm init --client-only --skip-refresh
    # 2. If Helm is installed on a node of a self-built Kubernetes cluster and you do not want to access Google charts, run the following command:
    helm init --skip-refresh                    

Configure a Container Registry Enterprise Edition instance

  1. Configure an access credential.

    On the Access Credential page of the Container Registry Enterprise Edition instance, set a password or temporary token, and obtain the logon account by moving the pointer over the profile picture in the top navigation bar. The account and password or temporary token are used as the access credential for accessing Helm charts.

    Obtain the logon account
  2. Configure access control policies.

    On the Access Control page of the Container Registry Enterprise Edition instance, you can enable access over the public network or specified Virtual Private Clouds (VPCs). This guarantees that Helm charts can be uploaded and downloaded.

    Add a VPCEnable access over the public network
  3. Create a chart repository.
    The following figure shows how to create a chart repository named repository in the namespace named namespace.Create a chart repository

    When Automatically Create Repository is selected for the namespace, you can directly use Helm to push charts to a chart repository without creating the chart repository in advance in the console. If the chart repository does not exist, it is automatically created.

    In Container Registry Enterprise Edition, you can access a chart repository in the following format: <Instance name>-chart.<Region ID>.cr.aliyuncs.com/<Namespace>/<Chart repository name>. The version of a chart repository is in the format of <Chart name>-<Version number>.

  4. Configure local repository mapping.

    You must specify a local repository and map it to a chart repository in a namespace in Container Registry.

    export HELM_REPO_USERNAME='<The account in the access credential of the Container Registry Enterprise Edition instance>';
    export HELM_REPO_PASSWORD='<The password in the access credential of the Container Registry Enterprise Edition instance>';
    helm repo add <Local repository name> acr://<Instance name>-chart.<Region ID>.cr.aliyuncs.com/<Namespace>/<Chart repository> --username ${HELM_REPO_USERNAME} --password ${HELM_REPO_PASSWORD}            
    Configure local repository mapping

Push charts

# Create a local chart.
helm create <Chart name>

# Push the chart directory.
helm push <Chart name> <Local repository name>

# Push the compressed chart package.
helm push <Chart name>-<Chart version>.tgz <Local repository name>            
Push charts

In the Container Registry console, a version is added to the chart repository, as shown in the following figure.

Version list

Pull charts

# Update the local chart index from the chart repository in Container Registry.
helm repo update

# Pull a chart.
helm fetch <Local repository name>/<Chart name> --version <Chart version>

# Install a chart directly.
helm install -f values.yaml <Local repository name>/<Chart name> --version <Chart version>