Getting started with Helm 3

Understanding Helm

Helm is a software package manager that simplifies deployment of applications and services to OKD clusters.

Helm uses a packaging format called charts. A Helm chart is a collection of files that describes the OKD resources.

A running instance of the chart in a cluster is called a release. A new release is created every time a chart is installed on the cluster.

Each time a chart is installed, or a release is upgraded or rolled back, an incremental revision is created.

Key features

Helm provides the ability to:

  • Search through a large collection of charts stored in the chart repository.

  • Modify existing charts.

  • Create your own charts with OKD or Kubernetes resources.

  • Package and share your applications as charts.

Installing Helm

The following section describes how to install Helm on different platforms using the CLI.

You can also find the URL to the latest binaries from the OKD web console by clicking the ? icon in the upper-right corner and selecting Command Line Tools.

Prerequisites

  • You have installed Go, version 1.13 or higher.

On Linux

  1. Download the Helm binary and add it to your path:

    1. # curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o /usr/local/bin/helm
  2. Make the binary file executable:

    1. # chmod +x /usr/local/bin/helm
  3. Check the installed version:

    1. $ helm version

    Example output

    1. version.BuildInfo{Version:"v3.0", GitCommit:"b31719aab7963acf4887a1c1e6d5e53378e34d93", GitTreeState:"clean", GoVersion:"go1.13.4"}

On Windows 7/8

  1. Download the latest .exe file and put in a directory of your preference.

  2. Right click Start and click Control Panel.

  3. Select System and Security and then click System.

  4. From the menu on the left, select Advanced systems settings and click Environment Variables at the bottom.

  5. Select Path from the Variable section and click Edit.

  6. Click New and type the path to the folder with the .exe file into the field or click Browse and select the directory, and click OK.

On Windows 10

  1. Download the latest .exe file and put in a directory of your preference.

  2. Click Search and type env or environment.

  3. Select Edit environment variables for your account.

  4. Select Path from the Variable section and click Edit.

  5. Click New and type the path to the directory with the exe file into the field or click Browse and select the directory, and click OK.

On MacOS

  1. Download the Helm binary and add it to your path:

    1. # curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-darwin-amd64 -o /usr/local/bin/helm
  2. Make the binary file executable:

    1. # chmod +x /usr/local/bin/helm
  3. Check the installed version:

    1. $ helm version

    Example output

    1. version.BuildInfo{Version:"v3.0", GitCommit:"b31719aab7963acf4887a1c1e6d5e53378e34d93", GitTreeState:"clean", GoVersion:"go1.13.4"}

Installing a Helm chart on an OKD cluster

Prerequisites

  • You have a running OKD cluster and you have logged into it.

  • You have installed Helm.

Procedure

  1. Create a new project:

    1. $ oc new-project mysql
  2. Add a repository of Helm charts to your local Helm client:

    1. $ helm repo add stable https://kubernetes-charts.storage.googleapis.com/

    Example output

    1. "stable" has been added to your repositories
  3. Update the repository:

    1. $ helm repo update
  4. Install an example MySQL chart:

    1. $ helm install example-mysql stable/mysql
  5. Verify that the chart has installed successfully:

    1. $ helm list

    Example output

    1. NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
    2. example-mysql mysql 1 2019-12-05 15:06:51.379134163 -0500 EST deployed mysql-1.5.0 5.7.27

Creating a custom Helm chart on OKD

Procedure

  1. Create a new project:

    1. $ oc new-project nodejs-ex-k
  2. Download an example Node.js chart that contains OKD objects:

    1. $ git clone https://github.com/redhat-developer/redhat-helm-charts
  3. Go to the directory with the sample chart:

    1. $ cd redhat-helm-charts/alpha/nodejs-ex-k/
  4. Edit the Chart.yaml file and add a description of your chart:

    1. apiVersion: v2 (1)
    2. name: nodejs-ex-k (2)
    3. description: A Helm chart for OpenShift (3)
    4. icon: https://static.redhat.com/libs/redhat/brand-assets/latest/corp/logo.svg (4)
    1The chart API version. It should be v2 for Helm charts that require at least Helm 3.
    2The name of your chart.
    3The description of your chart.
    4The URL to an image to be used as an icon.
  5. Verify that the chart is formatted properly:

    1. $ helm lint

    Example output

    1. [INFO] Chart.yaml: icon is recommended
    2. 1 chart(s) linted, 0 chart(s) failed
  6. Navigate to the previous directory level:

    1. $ cd ..
  7. Install the chart:

    1. $ helm install nodejs-chart nodejs-ex-k
  8. Verify that the chart has installed successfully:

    1. $ helm list

    Example output

    1. NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
    2. nodejs-chart nodejs-ex-k 1 2019-12-05 15:06:51.379134163 -0500 EST deployed nodejs-0.1.0 1.16.0