Helm versions earlier than V3.7 use an experimental Open Container Initiative (OCI) command set—helm3 chart save, push, pull, and export—instead of the helm push command in V3.7 and later. Use these commands to push and pull charts as OCI artifacts in a Container Registry Enterprise Edition instance.
Prerequisites
Before you begin, ensure you have the following:
-
A Container Registry Enterprise Edition instance. To create one, see the Container Registry documentation.
-
Helm V3 installed. Run
helm3 version -cto verify your version. This topic uses V3.0.2. -
Network access to your Enterprise Edition instance through the internet or a virtual private cloud (VPC).
Step 1: Configure your 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.
Log on to the Container Registry console.
-
In the left-side navigation pane, choose Repository > Namespace.
-
On the Namespace page, click Create Namespace.
-
In the Create Namespace dialog box, configure Namespace, Automatically Create Repository, and Default Configurations for Automatically Created Repositories, and then click Confirm.
Create an image repository
-
In the left-side navigation pane, choose Repositories > Repositories.
-
On the Repositories page, click Create Repository.
-
In the Repository Info step, configure Namespace, Repository Name, Repository Type, Image Version, Accelerated Image, Summary, and Description, and then click Next.
-
In the Code Source step, configure Code Source, Build Settings, and Build Rules, and then click Create Repository. The following table describes the key parameters:
Parameter
Description
Code Source
Select the code source.
Automatically Build Images When Code Changes
Triggers a build automatically when code is committed to a branch.
Build With Servers Deployed Outside Chinese Mainland
Builds images on servers outside the Chinese mainland and pushes them to the repository in the specified region. Enable this option if your Dockerfile pulls dependencies from sites outside the Chinese mainland and the cross-border connection is unstable.
Build Without Cache
Forces a fresh pull of the base image on every build, which may increase build time. Disable this option to use the cache and speed up builds.
-
On the Repositories page, click the image repository that you created. If Build appears 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
Use a password or token as the access credential for the image repository. This topic uses a password.
-
In the left-side navigation pane, choose Repositories > Access Credential.
-
On the Access Credential page, click Set Password.
-
In the Set Password dialog box, set Password and Confirm Password, and then click Confirm.
Configure an access control list (ACL)
Enable internet access or add a VPC so that you can push charts to the image repository. This topic uses internet access. For VPC access, see Configure a VPC ACL.
-
In the left-side navigation pane, choose Repositories > Access Control.
-
On the Access Control page, click the Internet tab.
-
Turn on Enable Access over Internet, and then click Add Internet Whitelist.
-
In the Add Internet Whitelist dialog box, specify the CIDR block and a description, and then click Confirm.
(Optional) Enable anonymous pull
After you enable anonymous pull, users can pull charts from a public image repository without logging on.
-
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.
Log on to the Container Registry console.
-
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
Set up Helm
-
Download Helm V3 from the official website. This topic uses V3.0.2. Run the following command to verify your version:
helm3 version -c -
Enable the OCI experimental feature:
export HELM_EXPERIMENTAL_OCI=1
Log on to the Enterprise Edition instance
Replace <Registry logon name> with your Alibaba Cloud account name, and replace <Name of the Enterprise Edition instance>.<Region in which the Enterprise Edition instance resides>.cr.aliyuncs.com with your instance endpoint.
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
When prompted, enter the password you set in Configure an access credential.
To pull charts from a public image repository without logging on, turn on Pull from Anonymous Users on the Overview page of your Enterprise Edition instance.
Push a chart
-
Create a sample chart:
helm3 create helloworld -
Save the chart directory as a tagged image in your Enterprise Edition instance repository:
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 -
Push the chart to your Enterprise Edition instance repository:
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
-
Pull the chart from your Enterprise Edition instance repository:
helm3 chart pull <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 pull m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest -
Export the chart to a local 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 . -
Install the chart:
helm3 install helloworld ./helloworld