Help Center/ Cloud Container Engine/ User Guide/ Helm Chart/ Deploying an Application Through the Helm v3 Client
Updated on 2024-08-16 GMT+08:00

Deploying an Application Through the Helm v3 Client

Prerequisites

  • The Kubernetes cluster created on CCE has been connected to kubectl. For details, see Using kubectl.
  • 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.

  1. Download the Helm client from the VM connected to the cluster.

    wget https://get.helm.sh/helm-v3.3.0-linux-amd64.tar.gz

  2. Decompress the Helm package.

    tar -xzvf helm-v3.3.0-linux-amd64.tar.gz

  3. Copy Helm to the system path, for example, /usr/local/bin/helm.

    mv linux-amd64/helm /usr/local/bin/helm

  4. Query the Helm version.

    helm version
    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.

  1. 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

  2. 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=false
    Run 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

  3. View the installed chart release.

    helm list

Common Issues

  • The following error message is displayed after the helm version command is run:
    Client:
    &version.Version{SemVer:"v3.3.0",
    GitCommit:"012cb0ac1a1b2f888144ef5a67b8dab6c2d45be6", GitTreeState:"clean"}
    E0718 11:46:10.132102    7023 portforward.go:332] an error occurred
    forwarding 41458 -> 44134: error forwarding port 44134 to pod
    d566b78f997eea6c4b1c0322b34ce8052c6c2001e8edff243647748464cd7919, uid : unable
    to 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
  • When you run the yum install socat –y command on a node running EulerOS 2.9 or Huawei Cloud EulerOS, the following error message is displayed:
    No match for argument: socat
    Error: Unable to find a match: socat

    The node image does not contain socat. In this case, manually download the RPM chart and run the following command to install it (replace the RPM chart name with the actual one):

    rpm -i socat-1.7.3.2-8.oe1.x86_64.rpm
    Table 1 Addresses for downloading socat RPM charts

    OS

    Where to Download

    EulerOS 2.9

    Huawei Cloud EulerOS 2.0

    Huawei Cloud EulerOS 1.1

    x86

  • When the socat has been installed and the following error message is displayed after the helm version command is run:
    $ helm version
    Client: &version.Version{SemVer:"v3.3.0", GitCommit:"021cb0ac1a1b2f888144ef5a67b8dab6c2d45be6", GitTreeState:"clean"}
    Error: cannot connect to Tiller

    The Helm chart reads the configuration certificate in .Kube/config to communicate with Kubernetes. The preceding error indicates that the kubectl configuration is incorrect. In this case, reconnect the cluster to kubectl. For details, see Using kubectl.

  • 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 following error message is displayed after the helm install command is run:
    # helm install prometheus/ --generate-name
    WARNING: This chart is deprecated
    Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp [::1]:8080: connect: connection refused

    Solution: Configure kubeconfig for the node. For details, see Using kubectl.