Deploying an Application Through the Helm v3 Client
Prerequisites
- The Kubernetes cluster created on CCE has been connected to kubectl. For details, see Procedure.
- To pull a public image when deploying Helm, ensure an EIP has been bound to the node.
Installing Helm v3
This section uses Helm v3.3.0 as an example.
For other versions, visit https://github.com/helm/helm/releases.
- Download the Helm client from the VM connected to the cluster.wget https://get.helm.sh/helm-v3.3.0-linux-amd64.tar.gz
- Decompress the Helm package.tar -xzvf helm-v3.3.0-linux-amd64.tar.gz
- Copy Helm to the system path, for example, /usr/local/bin/helm.mv linux-amd64/helm /usr/local/bin/helm
- Query the Helm version.helm version
Command output:
version.BuildInfo{Version:"v3.3.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}
Installing the Helm Chart
You can use Helm to install a chart. Before using Helm, you may need to understand the following concepts to better use Helm:
- Chart: contains resource definitions and a large number of configuration files of Kubernetes applications.
- Repository: stores shared charts. You can download charts from the repository to a local path for installation or install them online.
- Release: running result of after a chart is installed in a Kubernetes cluster using Helm. A chart can be installed multiple times in a cluster. A new release will be created for each installation. A MySQL chart is used as an example. To run two databases in a cluster, install the chart twice. Each database has its own release and release name.
For more details, see Using Helm.
- Search for a chart from the Artifact Hub repository recommended by Helm and configure the Helm repository.helm repo add {repo_name} {repo_addr}
The following uses the WordPress chart as an example:
helm repo add bitnami https://charts.bitnami.com/bitnami - Run the helm install command to install the chart.helm install {release_name} {chart_name} --set key1=val1
For example, to install WordPress, the WordPress chart added in 1 is bitnami/wordpress, the release name is my-wordpress, and mandatory parameters have been configured.
helm install my-wordpress bitnami/wordpress \--set mariadb.primary.persistence.enabled=true \--set mariadb.primary.persistence.storageClass=csi-disk \--set mariadb.primary.persistence.size=10Gi \--set persistence.enabled=falseRun the helm show values {chart_name} command to view the configurable options of the chart. For example, to view the configurable items of WordPress, run the following command:
helm show values bitnami/wordpress - View the installed chart release.helm list
Common Issues
- The following error message is displayed after the Helm version command is executed:Client:&version.Version{SemVer:"v3.3.0",GitCommit:"012cb0ac1a1b2f888144ef5a67b8dab6c2d45be6", GitTreeState:"clean"}E0718 11:46:10.132102 7023 portforward.go:332] an error occurredforwarding 41458 -> 44134: error forwarding port 44134 to podd566b78f997eea6c4b1c0322b34ce8052c6c2001e8edff243647748464cd7919, uid : unableto do port forwarding: socat not found.Error: cannot connect to Tiller
The preceding information is displayed because the socat is not installed. Run the following command to install the socat:
yum install socat -y - Socat has been installed. When you check the Helm version, the error message "Error: cannot connect to Tiller" is displayed.helm version
Error information:
Client: &version.Version{SemVer:"v3.3.0", GitCommit:"021cb0ac1a1b2f888144ef5a67b8dab6c2d45be6", GitTreeState:"clean"}Error: cannot connect to TillerThe Helm chart reads the configuration certificate in .Kube/config and communicates with Kubernetes. The preceding error indicates that the kubectl configuration is incorrect. In this case, reconnect the cluster to kubectl. For details, see Procedure.
- Storage fails to be created after you have connected to cloud storage services.
This issue may be caused by the annotation field in the created PVC. Change the chart name and install the chart again.
- If kubectl is not properly configured, the error message "Error: Kubernetes cluster unreachable..." will be displayed when you install Helm.
Example:
helm install prometheus/ --generate-nameError information:
WARNING: This chart is deprecatedError: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp [::1]:8080: connect: connection refusedSolution: Configure kubeconfig for the node. For details, see Procedure.
- Prerequisites
- Installing Helm v3
- Installing the Helm Chart
- Common Issues