Management Helm Chart

Last updated: 2024-03-25 14:32:23

Scenario

Tencent Container Registry (TCR) supports hosting Helm Charts, fulfilling users' needs for managing and distributing cloud-native applications. Users can simultaneously manage container images and Helm Charts within the same namespace, enabling the concurrent use of container images and Helm Chart cloud-native deliverables in business projects.
Currently, only TCR Enterprise Edition instances support hosting Helm Charts, allowing for uploading and downloading Charts using the console or Helm client. Helm Chart repositories inherit the public and private attributes of their respective namespaces without requiring additional configuration. In terms of permission management, Helm Charts share the repository resource type with container images. This means that the qcs::tcr:$region:$account:repository/tcr-xxxxxx/project-a/* resource description includes all image repositories and Helm Charts within the project-a namespace, providing flexibility when managing resource permissions.

Preparations

Make sure that the following conditions are met before uploading and managing Helm Charts in a TCR Enterprise Edition instance:
If you are using a sub-account, you must have granted the sub-account operation permissions for the corresponding instance. For more information, see Example of Authorization Solution of TCR Enterprise.

Instructions

Managing Helm Charts in the console

1. Log in to the TCR console and click Helm Chart in the left sidebar.
2. You can view the list of Helm Charts in the current instance on the "Helm Chart" page. To switch instances, select from the "Instance Name" dropdown list at the top of the page. The Chart list includes the following information and operations:
Name: Helm Chart name. You can click it to enter the Chart details page, where you can view and manage each version of the Chart. You can also view the file details of each version of the Chart package on the Basic Information tab.
Namespace: Namespace to which a Helm Chart belongs.
Create Time: Time when the Helm Chart was pushed to the repository for the first time.
Operation: Click Shortcuts to obtain the commands for the current repository. For more information, see Using the Helm client to upload and download Helm Charts. Click Delete to remove the current repository.
3. Click the name of the specified Helm chart repository to enter the repository details page.
Version Management: This page displays the existing Chart versions in the current repository, and you can download or delete the specified versions.
Basic Information: This page displays the Chart version details, such as Chart.yaml.

Using the console to upload and download Helm Charts

Uploading a local Helm chart package

1. Log in to the Container Registry console and select Helm Chart from the left sidebar. On the "Helm Chart" page, you can view the list of Helm Chart repositories in the current instance. To switch instances, select the desired instance name from the "Instance Name" drop-down list at the top of the page.
2. Click Upload. In the "Upload Helm Chart" window, configure as per the following instructions.
Associated Instance: Current instance selected.
Namespace: Namespace to which the Helm Chart repository belongs. If the list is empty, create a namespace in the instance.
Chart Package: Click to select a Helm Chart package that has been downloaded to the local system.
Note
Only Helm Chart packages in .tgz format are supported. Please avoid uploading other types of files. Note that uploading a file with the same name will overwrite the existing Chart, so proceed with caution.
3. Click Upload to start uploading the Helm Chart package. After uploading, you can view the uploaded Helm Chart on the repository list page. If the uploaded package does not have a corresponding Helm Chart repository, a new repository will be created automatically.

Downloading a Helm chart package to the local system

1. View the Helm Chart repository list in the current instance on the Helm Chart page. Click the specified repository to enter its version management page.
2. Select the specified version within the Chart repository and click Download on the right side of the row. The Chart package for that version will be automatically downloaded to your local system. Depending on your browser and settings, you can choose a specific download path.

Using the Helm client to upload and download Helm Charts

Installing a Helm client

Note
If you wish to use Helm in Tencent Kubernetes Engine (TKE), you need to select a v3.x.x version. You can run the helm version -c command to check the version of the installed client.
This document takes the installation on a Linux node as an example. For installation on other platforms, please download the corresponding installation package.
Run the following commands in sequence to download and install the Helm client. For more information, see Installing Helm.
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

Adding a Helm repository

1. Log in to the Container Registry Console, select the instance name from the "Instance List" page, and enter the instance details page.
2. Obtain the username and password used to log in to the instance. For more information, see Obtaining an Instance Access Credential.
3. Run the following command in the node to add the namespace used for Helm chart management to the local Helm repository.
Note
Ensure that the server running this command is in the Internet allowlist or connected VPC of the corresponding instance. For more information, see Configuring Public Network Access Control and Configuring Private Network Access Control.
helm repo add $instance-$namespace https://$instance.tencentcloudcr.com/chartrepo/$namespace --username $username --password $instance-token
$instance-$namespace: Name of the Helm repository. We recommend that you use the combination of instance name + namespace name for naming so as to distinguish between instances and namespaces.
https://$instance.tencentcloudcr.com/chartrepo/$namespace: Remote address of the Helm repository.
$username: Username obtained in Step 2.
$instance-token: Password obtained in Step 2. If the add operation is successful, the following message will be prompted.
"$instance-$namespace" has been added to your repositories

Pushing Helm Charts

1. Install the Helm Push plugin.
Note
Install the helm-push plugin of the v0.10.0 or a later version. Otherwise, version incompatibility may cause Helm Chart package pushing to fail.
If using a version prior to v0.10.0, replace the helm cm-push command with the helm push command.
To upload Chart packages using the Helm CLI, you need to install the helm-push plugin. This plugin supports pushing Helm Charts to a specified repository using the helm push command and supports uploading both directories and compressed packages.
helm plugin install https://github.com/chartmuseum/helm-push
2. Run the following command on the node to create a Chart.
helm create tcr-chart-demo
3. Run the following command to directly push the specified directory to the Chart repository (optional).
helm cm-push tcr-chart-demo $instance-$namespace
Here, $instance-$namespace is the name of the added local repository.
4. Run the following command to compress the specified directory and push it to the Chart repository.
tar zcvf tcr-chart-demo-1.0.0.tgz tcr-chart-demo/
helm cm-push tcr-chart-demo-1.0.0.tgz $instance-$namespace
Here, $instance-$namespace is the name of the added local repository.

Pulling Helm Charts

1. Run the following command on the node to obtain the latest Chart information.
helm repo update
2. Run the following command to pull the Helm Chart on the specified version:
helm fetch <Local repository name>/<Chart name> --version <Chart version>
In the following example, tcr-chart-demo 1.0.0 in the project-a namespace is pulled from the tcr-demo TCR Enterprise Edition instance:
helm fetch tcr-demo-project-a/tcr-chart-demo --version 1.0.0