When you deploy an application in Container Service for Kubernetes (ACK), you must configure multiple resources, including workloads, services, Ingresses, and ConfigMaps. You can use Helm to deploy and update the resources based on applications to achieve more efficient application management. ACK integrates Helm in the console and provides common third-party applications such as WordPress, Dify, and ComfyUI. This topic describes how to deploy applications in an ACK cluster by using Helm.
Introduction to Helm
Helm is an open source tool that is used to manage applications in Kubernetes clusters. Helm provides a unified method to package software and manage software versions. You can use Helm to simplify the deployment and management of Kubernetes applications. The following table describes the basic concepts of Helm. For more information, see Helm.
Term | Description |
Term | Description |
Chart | A packaging format used by Helm. Each chart contains the images, dependencies, and resource definitions that are required to run an application. A chart may contain service definitions used in a Kubernetes cluster. A Helm chart is similar to a Homebrew formula, an Advanced Package Tool (APT) dpkg, or a Yum rpm. |
Release | An instance of a chart that runs in a Kubernetes cluster. A chart can be installed multiple times in a Kubernetes cluster. After a chart is installed, a new release is created. For example, if you want to use a MySQL chart to run two databases on a server, you can install the chart twice and generate a release and a release name each time you install the chart. |
Helm CLI | The client of Helm, which is locally runs. Helm CLI can be used to deploy third-party charts in ACK clusters. |
Repository | A repository is used to store charts. Helm CLI can access the index file and packaged charts in a chart repository over HTTP. |
Prerequisites
An ACK cluster is created. For more information, see Create an ACK managed cluster.
Connect to the cluster by using kubectl, and the Helm CLI is installed. For more information, see Obtain the kubeconfig file of a cluster and use kubectl to connect to the cluster and Installing Helm.
Deploy an application in the ACK console
ACK provides charts of some common applications. You can use the charts to install applications in the console. The following steps describe how to install WordPress by using Helm.
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the cluster that you want to manage and click its name. In the left-side pane, choose
.On the Helm page, click Deploy. In the Basic Information step, configure the parameters based on the following table.
Parameter
Description
Example
Parameter
Description
Example
Application Name
The name of the release in the cluster.
wordpress
Namespace
The namespace in which the release is deployed.
default
Source
The source of charts. Marketplace or ACR EE can be selected.
Marketplace
Chart
The chart used to install the application.
ack-wordpress-sample
Click Next in the lower-left corner of the panel and select the latest chart version. Confirm the chart content and click OK in the lower part of the panel.
After WordPress is installed, run the following command to obtain the external IP address (
EXTERNAL-IP
):kubectl get svc --namespace default
The expected output indicates that the
EXTERNAL-IP
is118.xx.xx. 10
.NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE wordpressabc-ack-wordpress-sample LoadBalancer 172.16.86.22 118.190.xx.xx 80:30837/TCP,443:32433/TCP 33m wordpressabc-mariadb ClusterIP 172.16.70.108 <none> 3306/TCP 33m
Run the
kubectl get pod
command to obtain the name of the WordPress pod, and then run the following command to obtain the access user:kubectl get pod <wordpress-ack-wordpress-sample-name> -o=jsonpath='{.spec.containers[*].env[?(@.name=="WORDPRESS_USERNAME")].value}'
Expected output:
user
Run the following command to obtain the password:
kubectl get secret --namespace default wordpress-ack-wordpress-sample -o jsonpath="{.data.wordpress-password}" | base64 --decode
Expected output:
ps**jRx**V
In a browser, enter the
EXTERNAL-IP
that you obtained in the previous step, add/login
after the IP to access the WordPress application, and then enter the user and password on the login page.
Manage the installed applications in the console
You can perform operations on the installed release on the Helm page.
Click Release Name or View Details to view information about the release, such as resources, YAML files, and history versions.
Click Update. In the Update Release panel, modify the parameters based on your requirements and click OK to update the release.
Click Delete. In the Delete dialog box, select Clear Release Records and click OK. After the release is deleted, the resources of the release are deleted, including the Services and Deployments.
If you clear Clear Release Records, the release is not deleted. The release remains in the release list. If you create another release that has the same name, a release name conflict occurs. As a result, applications that have the same name as the release fail to be deployed.
Use a third-party chart repository to deploy applications by using the Helm CLI
If the charts provided by ACK cannot meet your requirements, you can use third-party charts to deploy applications by using the Helm CLI.
helm repo add <REPO_NAME> <REPO_URL> # Add a chart repository. Replace REPO_NAME with the name of the chart repository. Replace REPO_URL with the address of the chart repository.
helm repo update # Update repository information.
helm install <APP_NAME> <REPO_NAME>/<CHART_NAME> # Install the application. Replace APP_NAME with the name of an application and CHART_NAME with the name of a chart.
For more information about Helm commands, see Using Helm.
References
To prevent the potential security risks imposed by the Helm V2 server Tiller, we recommend that you update Helm V2 to Helm V3 to use more Helm features. Otherwise, attackers may use Tiller to install unauthorized applications in your cluster. You can run the following command to view the Helm version in the cluster: For more information about the update operations, see Update Helm V2 to Helm V3.
helm version
Expected output:
version.BuildInfo{Version:"***", GitCommit:"***", GitTreeState:"***", GoVersion:"go***"}
You can use the Helm chart feature of the Container Registry Enterprise Edition instance to pull and push charts. For more information, see Push and pull Helm charts.