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
Create a namespace.
Log on to the Container Registry console.
In the left-side navigation pane, click Instances.
On the Instances page, click the Enterprise Edition instance that you want to manage.
In the left-side navigation pane of the management page of the Container Registry Enterprise Edition instance, choose .
On the Namespace page, click Create Namespace.
In the Create Namespace dialog box, configure the Namespace, Automatically Create Repository, and Default Repository Type parameters, and then click Confirm.
Creates an image repository.
In the left-side navigation pane of the management page of the Enterprise Edition instance, choose .
On the Repositories page, click Create Repository.
In the Repository Info step, configure the Namespace, Repository Name, Repository Type, Tags, Accelerated Images, Summary, and Description parameters. Then, click Next.
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.
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.
In the left-side navigation pane of the management page of the Enterprise Edition instance, choose .
On the Access Credential page, click Set Password.
In the Set Password dialog box, set the Password and Confirm Password parameters. Click Confirm.
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.
In the left-side navigation pane of the management page of the Enterprise Edition instance, choose .
On the Access Control page, click the Internet tab.
On the Internet tab, turn on Enable Access over Internet and click Add Internet Whitelist.
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.
(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.
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Enterprise Edition instance that you want to manage.
In the Instance Settings section on the right side of the Overview page, turn on Pull from Anonymous Users.
In the Tips dialog box, click Confirm.
Step 2: Push and pull charts
Download Helm of the required version from the official website.
NoteMake 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.Run the following command to enable the experimental feature for the Helm 3:
export HELM_EXPERIMENTAL_OCI=1
Run the following command to log on to the Enterprise Edition instance:
Replace the username in the command by using your Alibaba Cloud account.
NoteIf 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.
Run the following command to create a HelloWorld chart:
helm3 create helloworld
Push and pull the chart.
Push the chart to the image repository.
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
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.
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
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 .
Run the following command to install the HelloWorld chart:
helm install helloworld ./helloworld