All Products
Search
Document Center

Container Registry:Use Helm earlier than V3.7 to push and pull charts

Last Updated:Dec 26, 2023

Before you push and pull Helm 3 charts, you must create an Open Container Initiative (OCI) image repository to store and manage charts. The OCI image repository can be a local file system, network server, or cloud storage device. The operations of pushing and pulling charts by using Helm versions earlier than V3.7 are different from the operations of pushing and pulling charts by using the Helm cm-push plug-in. This topic describes how to use a Helm version earlier than V3.7 to push and pull charts.

Step 1: Configure your Container Registry Enterprise Edition instance

  1. Create a namespace.

    1. Log on to the Container Registry console.

    2. In the left-side navigation pane, click Instances.

    3. On the Instances page, click the Enterprise Edition instance that you want to manage.

    4. In the left-side navigation pane of the management page of the Container Registry Enterprise Edition instance, choose Repository > Namespace.

    5. On the Namespace page, click Create Namespace.

    6. In the Create Namespace dialog box, configure the Namespace, Automatically Create Repository, and Default Repository Type parameters, and then click Confirm.

  2. Creates an image repository.

    1. In the left-side navigation pane of the management page of the Enterprise Edition instance, choose Repository > Repositories.

    2. On the Repositories page, click Create Repository.

    3. In the Repository Info step, configure the Namespace, Repository Name, Repository Type, Tags, Accelerated Images, Summary, and Description parameters. Then, click Next.

    4. In the Code Source step, configure the Code Source, Build Settings, and Build Rules parameters, and then click Create Repository. The following table describes key parameters.

      Parameter

      Description

      Code Source

      The code source.

      Build Settings

      • Automatically Build Images When Code Changes: The building rule is automatically triggered when code is committed from a branch.

      • Build With Servers Deployed Outside Chinese Mainland: Images are built on servers outside the Chinese mainland and then pushed to a repository in the specified region. If the Dockerfile used in your project must be downloaded from a site outside the Chinese mainland but the cross-border network connection is unstable, you can enable Build With Servers Deployed Outside Chinese Mainland.

      • Build Without Cache: The system pulls the base image from the source code repository each time an image is built. This may increase the building time period. You can disable Build Without Cache to accelerate the image building.

      On the Repositories page, click the created image repository. If Build is displayed in the left-side navigation pane of the repository management page, the image repository is bound to the source code repository.

  3. Configure an access credential.

    You can configure a password or tokens as the access credential of the image repository. In this example, a password is configured as the access credential.

    1. In the left-side navigation pane of the management page of the Enterprise Edition instance, choose Repsitory > Access Credential.

    2. On the Access Credential page, click Set Password.

    3. In the Set Password dialog box, set the Password and Confirm Password parameters. Click Confirm.

  4. Configure an access control list (ACL).

    Enable Internet access or add a virtual private cloud (VPC) to enable VPC access. This ensures that charts can be pushed to the image repository. In this example, Internet access is enabled. For information about how to enable VPC access, see Configure a VPC ACL.

    1. In the left-side navigation pane of the management page of the Enterprise Edition instance, choose Repository > Access Control.

    2. On the Access Control page, click the Internet tab.

    3. On the Internet tab, turn on Enable Access over Internet and click Add Internet Whitelist.

    4. In the Add Internet Whitelist dialog box, specify the CIDR block that is allowed to access the image repository and the description, and click Confirm.

  5. (Optional) Turn on Pull from Anonymous Users.

    After you turn on Pull from Anonymous Users, you can pull charts from a public image repository as an anonymous user.

    1. Log on to the Container Registry console.

    2. In the top navigation bar, select a region.

    3. In the left-side navigation pane, click Instances.

    4. On the Instances page, click the Enterprise Edition instance that you want to manage.

    5. In the Instance Settings section on the right side of the Overview page, turn on Pull from Anonymous Users.

    6. In the Tips dialog box, click Confirm.

Step 2: Push and pull charts

  1. Download Helm of the required version from the official website.

    Note

    Make sure that the version of the client is V3. You can run the helm3 version -c command to check the version. In this example, the version of the client is V3.0.2.

  2. Run the following command to enable the experimental feature for the Helm 3:

    export HELM_EXPERIMENTAL_OCI=1
  3. Run the following command to log on to the Enterprise Edition instance:

    Replace the username in the command by using your Alibaba Cloud account.

    Note

    If you push and pull charts from a public chart repository, you can turn on Pull from Anonymous Users on the Overview page of the Container Registry Enterprise Edition instance in the Container Registry console. This way, you can pull charts from the image repository as an anonymous user.

    helm3 registry login --username=<Registry logon name> <Name of the Enterprise Edition instance>.<Region in which the Enterprise Edition instance resides>.cr.aliyuncs.com

    Example:

    helm3 registry login --username=123@188077086902**** m**-registry.cn-hangzhou.cr.aliyuncs.com

    In the command output, enter the logon password. The logon password is the password that you set in Step 1.

  4. Run the following command to create a HelloWorld chart:

    helm3 create helloworld
  5. Push and pull the chart.

    • Push the chart to the image repository.

      1. Run the following command to save the chart directory as the tag of image repository of the Enterprise Edition instance:

        helm3 chart save helloworld <Name of the Enterprise Edition instance>.<Region in which the Enterprise Edition instance resides>.cr.aliyuncs.com/<Namespace name>/<Name of the image repository>:<Image tag>

        Example:

        helm3 chart save helloworld m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest
      2. Run the following command to push the tag to the image repository in the Enterprise Edition instance.

        helm3 chart push <Name of the Enterprise Edition instance>.<Region in which the Enterprise Edition instance resides>.cr.aliyuncs.com/<Namespace name>/<Name of the image repository>:<Image tag>

        Example:

        helm3 chart push m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest
    • Pull a chart from the image repository.

      1. Run the following command to pull the specified tag from the image repository in the Enterprise Edition instance.

        helm3 chart save helloworld <Name of the Enterprise Edition instance>.<Region in which the Enterprise Edition instance resides>.cr.aliyuncs.com/<Namespace name>/<Name of the image repository>:<Image tag>

        Example:

        helm3 chart save helloworld m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest
      2. Run the following command to export the chart tag to a local directory. Then, you can view the local chart directory.

        helm3 chart export <Name of the Enterprise Edition instance>.<Region in which the Enterprise Edition instance resides>.cr.aliyuncs.com/<Namespace name>/<Name of the image repository>:<Image tag> -d .

        Example:

        helm3 chart export m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest -d .
      3. Run the following command to install the HelloWorld chart:

         helm install helloworld ./helloworld