This topic introduces the basic concepts of Helm and describes how to use Helm to deploy an Apache Spark-based WordPress application in a Container Service for Kubernetes (ACK) cluster.

Prerequisites

  • An ACK cluster is created before you use Helm to deploy an application. For more information, see Create an ACK managed cluster.

    Tiller is automatically deployed to the cluster when the Kubernetes cluster is created. The Helm CLI is automatically installed on each master node. An Alibaba Cloud chart repository is added to Helm.

  • A Kubernetes version that supports Helm is used.

    Only Kubernetes 1.8.4 and later support Helm. If the Kubernetes version of your cluster is 1.8.1, you can upgrade the cluster on the Clusters page of the ACK console.

Background information

Application management is the most challenging task in Kubernetes. The Helm project provides a unified method to package software and manage software versions. You can use Helm to simplify application distribution and deployment. App Catalog is integrated with Helm in the ACK console and provides extended features based on Helm. App Catalog also supports Alibaba Cloud chart repositories to help you accelerate application deployments. You can deploy applications in the ACK console or by using the Helm CLI.

Basic terms

Helm is an open source project initiated by Deis. Helm can be used to simplify the deployment and management of Kubernetes applications.

Helm serves as a package manager for Kubernetes and allows you to find, share, and use applications built by Kubernetes. Before you use Helm, you must familiarize yourself with the following basic terms:

  • 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 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, you can install a MySQL chart. If you want to run two databases in your cluster, you can install the MySQL chart twice. Each time a chart is installed, a release is created with a different name.
  • Repository: the storage of charts. Charts are published and stored in repositories.

Helm components

Helm uses a client-server architecture and consists of the following components:

  • The Helm CLI is the Helm client that runs on your on-premises machine or on the master nodes of a Kubernetes cluster.
  • Tiller is the server-side component and runs in a Kubernetes cluster. Tiller manages the lifecycles of Kubernetes applications.
  • A repository is used to store charts. The Helm client can access the index file and packaged charts in a chart repository over HTTP.

Deploy an application in the ACK console

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, choose Marketplace > App Catalog.
  3. On the App Catalog tab, select and click a chart to go to the details page. In this example, ack-wordpress-sample is used.
  4. Click Deploy in the upper-right corner of the page. In the Deploy panel, select a cluster and namespace, and click Next.
  5. On the Parameters wizard page, specify the parameters and click OK.
    In this example, a persistent volume claim (PVC) is specified to bind a dynamically provisioned disk volume. For more information, see Use a dynamically provisioned disk volume.
    Note You must first provision a disk as a persistent volume (PV). The capacity of the PV cannot be less than the capacity specified in the PVC.
  6. In the left-side navigation pane of the details page, choose Network > Services
  7. In the Service list, you can find the Service created for the application and the corresponding external endpoints through HTTP and HTTPS. Click an external endpoint to access the WordPress blog page.
    Note Before you access the external endpoint, make sure that the port of the endpoint is added to the security group.

Deploy an application by using the Helm CLI

After Helm CLI is automatically installed in the ACK cluster and the required chart repository is added to Helm, you can log on to the cluster by using SSH. Then, you can deploy applications by using Helm CLI. For more information, see Connect to the master nodes of a dedicated Kubernetes cluster by using SSH. You can also install and configure the Helm CLI and kubectl on your on-premises machine.

In this example, the Helm CLI and kubectl are installed and configured on your on-premises machine, and then an Apache Spark-based WordPress application is deployed.

  1. Install and configure the Helm CLI and kubectl.
    1. Install and configure kubectl on your on-premises machine.
      For more information, see Connect to ACK clusters by using kubectl.

      To view the details of a Kubernetes cluster, run the kubectl cluster-info command.

    2. Install Helm on your on-premises machine.
      For more information, see Install Helm.
  2. Deploy the WordPress application.

    In the following example, a WordPress blog website is deployed by using Helm.

    1. Run the following command:
      helm install --name wordpress-test stable/wordpress
      Note ACK supports dynamic disk volumes. You must first provision a disk as a PV.

      The following output is returned:

      NAME:   wordpress-test
      LAST DEPLOYED: Mon Nov  20 19:01:55 2017
      NAMESPACE: default
      STATUS: DEPLOYED
      ...
    2. Run the following commands to query the release and Service created for the WordPress application:
      helm list
      kubectl get svc
    3. Run the following command to view the pods provisioned for the WordPress application. You may need to wait before the pods change to the Running state.
      kubectl get pod
    4. Run the following command to obtain the endpoint of the WordPress application:
      echo http://$(kubectl get svc wordpress-test-wordpress -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

      You can enter the preceding URL in the address bar of your browser to access the WordPress application.

      You can also run the following commands based on the chart description to obtain the username and password of the administrator for the WordPress application:

      echo Username: user
      echo Password: $(kubectl get secret --namespace default wordpress-test-wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)
    5. To delete the WordPress application, run the following command:
      helm delete --purge wordpress-test

Use a third-party chart repository

You can use the default Alibaba Cloud chart repository. If a third-party chart repository is accessible from your cluster, you can also use the third-party chart repository. Run the following command to add a third-party chart repository to Helm:

helm repo add Repository name Repository URL
helm repo update

For more information about Helm commands, see Helm documentation.

References

Helm contributes to the development of Kubernetes. A growing number of software suppliers, such as Bitnami, have provided high-quality charts. For more information about available charts, visit https://kubeapps.com/.