All Products
Search
Document Center

Container Registry:Use the Helm cm-push plug-in to push and pull charts

Last Updated:Apr 01, 2024

The Helm cm-push plug-in allows you to push and pull charts. Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. Before you use the Helm cm-push plug-in to push charts to a remote chart repository, you must run the helm plugin install command to install the Helm cm-push plug-in on your on-premises device. Then, you can run the helm push command to push charts.

Important

If you want to use the Helm cm-push plug-in to push and pull charts over HTTP, you must submit a ticket to add the local IP address of the chart repository to the whitelist.

Step 1: Configure your 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 Enterprise Edition instance, choose Helm Chart > 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. Create a chart repository.

    Note

    When Automatically Create Repository is enabled for the namespace, you can use Helm to push charts to a chart repository without the need to create the chart repository in advance in the Container Registry console.

    The chart repository of the Enterprise Edition instance is in the following format: <Instance name>-chart.<Region ID>.cr.aliyuncs.com/<Namespace>/<Chart repository name>. The version of the chart repository is <Chart name>-<Version number>. If you want to access the chart repository over a virtual private cloud (VPC), the chart repository must be in the following format: <Instance name>-chart-vpc.<Region ID>.cr.aliyuncs.com/<Namespace>/<Chart repository name>.

    1. On the Overview page of the Enterprise Edition instance, turn on Charts in the Component Settings section.

    2. In the left-side navigation pane of the management page of the Enterprise Edition instance, choose Helm Chart > Repositories.

    3. On the Repositories page, click Create Repositories.

    4. In the Create Helm Chart dialog box, configure the Namespace, Repository Name, and Type parameters, and then click Confirm.

  3. Configure an access credential.

    Set a password or a temporary token that is used to access Helm charts. 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 Instances > Access Credential.

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

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

  4. Configure an access control policy.

    Enable Internet access or VPC access to ensure that Helm charts can be pushed to repositories. 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 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 blocks that are allowed to access the Enterprise Edition instance and the notes, and then click Confirm.

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

    After you turn on Pull from Anonymous Users, you can access the public chart repository anonymously without logging on.

    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 of the Enterprise Edition instance, turn on Pull from Anonymous Users.

    6. In the Tips dialog box, click OK.

Step 2: Install and configure the Helm client

  1. Download Helm.

    Note

    You can use a Helm 3.7 or later client to push and pull charts. You can run the helm version -c command to view the versions of helm clients. In this example, Helm 3.10.0 is downloaded to push and pull charts.

  2. Run the following command to decompress the Helm installation package and place the Helm installation package in the specified directory:

    # Decompress the installation package. 
    tar -zxvf helm-v3.10.0-rc.1-linux-amd64.tar.gz
    # Move the extracted files to the specified directory. 
    mv linux-amd64/helm /usr/local/bin/helm    
  3. Run the following command to install the Helm cm-push plug-in:

    Note

    Before you install the Helm cm-push plug-in, run the yum install git command to install Git.

    helm plugin install https://github.com/chartmuseum/helm-push

Step 3: Push and pull charts

  1. Run the following command to specify the name of an on-premises repository and map the repository name to a chart repository in a namespace in Container Registry:

    helm repo add <Name of the on-premises repository> https://test9-7-chart****.cn-hangzhou.cr.aliyuncs.com/ns1/repo1 --username <username> --password <password>
  2. Run the following command to push charts:

    # Create an on-premises chart. 
    helm create <Chart name>
     
    # Push the chart directory. 
    helm cm-push <Chart name> <Name of the on-premises repository>

    In the left-side navigation pane of the Container Registry Enterprise Edition instance, choose Helm Chart > Repositories. On the Repositories page, click the name of the chart repository that you want to view and then click Versions. On the Versions page, you can view the new chart that you pushed.

  3. Run the following commands to install and pull charts:

    # Update the on-premises chart index from the chart repository in Container Registry. 
    helm repo update
     
    # Pull a chart. 
    helm fetch <Name of the on-premises repository>/<Chart name> --version <Chart version>
    # Directly install a chart.
    helm install -f values.yaml <Name of the on-premises repository>/<Chart name> --version <Chart version>