Chapter 5. Working with Helm charts
5.1. Understanding Helm Copy linkLink copied to clipboard!
Helm is a software package manager that simplifies deployment of applications and services to Red Hat OpenShift Service on AWS clusters.
Helm uses a packaging format called charts. A Helm chart is a collection of files that describes the Red Hat OpenShift Service on AWS resources.
Installing a chart in a cluster creates a running instance of the chart, called a release.
Each time you install a chart, or upgrade or roll back a release, Helm creates a revision of the release.
Red Hat OpenShift Service on AWS supports the following ways to work with Helm:
-
The Helm CLI, a Red Hat build of the
helmcommand-line tool that you install on your workstation. - The web console, where you can browse, install, and manage Helm charts and releases from your web browser.
5.1.1. Key features Copy linkLink copied to clipboard!
With Helm, you can:
- Search for charts in chart repositories.
- Install a chart to create a release.
- Upgrade a release, roll it back to an earlier revision, or delete it.
- Create your own charts with Red Hat OpenShift Service on AWS or Kubernetes resources, and package and share them.
5.1.2. Red Hat Certification of Helm charts for OpenShift Copy linkLink copied to clipboard!
You can have Red Hat certify your Helm charts for all components you deploy on Red Hat OpenShift Service on AWS. Charts go through an automated Red Hat OpenShift certification workflow that checks security compliance and integration with the platform. Certification assures chart integrity and confirms that your Helm chart works on Red Hat OpenShift clusters.
5.2. Installing Helm Copy linkLink copied to clipboard!
Install the Helm CLI to manage software packages on your Red Hat OpenShift Service on AWS cluster from a local workstation.
The Helm v4 CLI is now the current version of the Helm CLI for Red Hat OpenShift Service on AWS. You can still use the Helm v3 CLI in Red Hat OpenShift Service on AWS 5.0, but it is not available in Red Hat OpenShift Service on AWS 5.1 and later. For information about moving from Helm v3 to Helm v4, see "Helm CLI for Red Hat OpenShift compatibility matrix."
The Helm v3 CLI is a deprecated feature. Deprecated functionality is still included in Red Hat OpenShift Service on AWS and continues to be supported; however, it will be removed in a future release of this product and is not recommended for new deployments.
For the most recent list of major functionality that has been deprecated or removed within Red Hat OpenShift Service on AWS, refer to the Deprecated and removed features section of the Red Hat OpenShift Service on AWS release notes.
You can find the URL to the latest binaries in the Red Hat OpenShift Service on AWS web console by clicking the help icon (?) and selecting Command Line Tools.
Replace <version> in the curl commands with the Helm version that matches your Red Hat OpenShift Service on AWS cluster version. For more information, see "Helm CLI for Red Hat OpenShift compatibility matrix."
5.2.1. On Linux Copy linkLink copied to clipboard!
Download the Helm binary:
Linux (x86_64, amd64)
# curl -L https://mirror.openshift.com/pub/cgw/helm/<version>/helm-linux-amd64 -o /usr/local/bin/helmLinux on IBM Z® and IBM® LinuxONE (s390x)
# curl -L https://mirror.openshift.com/pub/cgw/helm/<version>/helm-linux-s390x -o /usr/local/bin/helmLinux on IBM Power® (ppc64le)
# curl -L https://mirror.openshift.com/pub/cgw/helm/<version>/helm-linux-ppc64le -o /usr/local/bin/helmLinux on ARM (arm64)
# curl -L https://mirror.openshift.com/pub/cgw/helm/<version>/helm-linux-arm64 -o /usr/local/bin/helm
Make the binary file executable:
# chmod +x /usr/local/bin/helmCheck the installed version:
$ helm versionExample output
version.BuildInfo{Version:"v3.0", GitCommit:"b31719aab7963acf4887a1c1e6d5e53378e34d93", GitTreeState:"clean", GoVersion:"go1.13.4"}
5.2.2. On Windows Copy linkLink copied to clipboard!
-
Go to https://mirror.openshift.com/pub/cgw/helm/, open the folder for your Helm version, and download
helm-windows-amd64.exe. -
Click Search and type
envorenvironment. - Select Edit environment variables for your account.
- Select Path from the Variable section and click Edit.
- 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.
5.2.3. On macOS Copy linkLink copied to clipboard!
Download the Helm binary:
For macOS on Intel (x86_64):
# curl -L https://mirror.openshift.com/pub/cgw/helm/<version>/helm-darwin-amd64 -o /usr/local/bin/helmFor macOS on ARM (Apple Silicon):
# curl -L https://mirror.openshift.com/pub/cgw/helm/<version>/helm-darwin-arm64 -o /usr/local/bin/helm
Make the binary file executable:
# chmod +x /usr/local/bin/helmCheck the installed version:
$ helm versionExample output
version.BuildInfo{Version:"v3.0", GitCommit:"b31719aab7963acf4887a1c1e6d5e53378e34d93", GitTreeState:"clean", GoVersion:"go1.13.4"}
5.3. Configuring custom Helm chart repositories Copy linkLink copied to clipboard!
The Software Catalog displays Helm charts available in the cluster. By default, it lists charts from the Red Hat OpenShift Helm repository.
As a cluster administrator, you can add cluster-scoped and namespace-scoped Helm chart repositories in addition to the default. The Software Catalog displays charts from all of them.
As a project member with the required role-based access control (RBAC) permissions, you can also add namespace-scoped Helm chart repositories. The Software Catalog displays the Helm charts from these repositories.
On the Ecosystem
- Create Helm Releases and Repositories using the Create button.
- Create, update, or delete a cluster-scoped or namespace-scoped Helm chart repository.
- View the list of the existing Helm chart repositories in the Repositories tab, which can also be easily distinguished as either cluster scoped or namespace scoped.
5.3.1. Creating Helm releases by using the web console Copy linkLink copied to clipboard!
You can use either the web console or the CLI to create a Helm release from a chart. The web console lists Helm releases on the Ecosystem
Prerequisites
- You have logged in to the web console.
Procedure
-
Navigate to Ecosystem
Software Catalog. - Under Type, click Helm Charts.
- Select a chart and read the description, README, and other details about the chart.
- Click Create.
In the Create Helm Release page:
- Enter a unique name for the release in the Release Name field.
- Select the required chart version from the Chart Version drop-down list.
Configure your Helm chart by using the Form View or the YAML View.
NoteWhere available, you can switch between the YAML View and Form View. The web console keeps your data when you switch between views.
Click Create to create a Helm release. The web console displays the new release on the Ecosystem
Helm page. If a Helm chart has release notes, the web console displays them.
If a Helm chart creates workloads, the web console displays them on the Helm release details page. The workloads are
DaemonSet,CronJob,Pod,Deployment, andDeploymentConfig.You can upgrade, roll back, or delete a Helm release from the overflow menu in its row on the Ecosystem
Helm page.
5.3.2. Using Helm in the web terminal Copy linkLink copied to clipboard!
You can run Helm CLI commands in the web terminal.
5.3.3. Creating a custom Helm chart on Red Hat OpenShift Service on AWS Copy linkLink copied to clipboard!
You can create a custom Helm chart on Red Hat OpenShift Service on AWS to package and deploy application resources using the Helm CLI.
Procedure
Create a new project:
$ oc new-project nodejs-ex-kDownload an example Node.js chart that contains Red Hat OpenShift Service on AWS objects:
$ git clone https://github.com/redhat-developer/redhat-helm-chartsGo to the directory with the sample chart:
$ cd redhat-helm-charts/alpha/nodejs-ex-k/Edit the
Chart.yamlfile and add a description of your chart:apiVersion: v2 name: nodejs-ex-k description: A Helm chart for OpenShift icon: https://static.redhat.com/libs/redhat/brand-assets/latest/corp/logo.svg version: 0.2.1where:
apiVersion-
Specifies the chart API version. It should be
v2for Helm charts that require at least Helm 3. name- Specifies the name of your chart.
description- Specifies the description of your chart.
icon- Specifies the URL to an image to be used as an icon.
version- Specifies the version of your chart as per the Semantic Versioning (SemVer) 2.0.0 Specification.
Verify that the chart is formatted properly:
$ helm lintExample output
[INFO] Chart.yaml: icon is recommended 1 chart(s) linted, 0 chart(s) failedNavigate to the previous directory level:
$ cd ..Install the chart:
$ helm install nodejs-chart nodejs-ex-kVerify that the chart has installed successfully:
$ helm listExample output
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION nodejs-chart nodejs-ex-k 1 2019-12-05 15:06:51.379134163 -0500 EST deployed nodejs-0.1.0 1.16.0
5.3.4. Filtering Helm Charts by their certification level Copy linkLink copied to clipboard!
You can filter Helm charts based on their certification level in the Developer Catalog.
Procedure
- In the Developer perspective, navigate to the +Add view and select a project.
- From the Developer Catalog tile, select the Helm Chart option to see all the Helm charts in the Developer Catalog.
Use the filters to the left of the list of Helm charts to filter the required charts:
- Use the Chart Repositories filter to filter charts provided by Red Hat Certification Charts or OpenShift Helm Charts.
Use the Source filter to filter charts sourced from Partners, Community, or Red Hat. Certified charts are indicated with the (
) icon.
NoteThe Source filter will not be visible when there is only one provider type.
You can now select the required chart and install it.
5.4. Working with Helm releases Copy linkLink copied to clipboard!
You can use the web console to create, update, roll back, or delete a Helm release.
5.4.1. Installing a Helm release from a URL Copy linkLink copied to clipboard!
A Helm release is a deployed instance of a Helm chart in your Red Hat OpenShift Service on AWS cluster. You can install a Helm release directly from a chart URL instead of from the software catalog.
Usually, you install charts from the software catalog in the web console. By default, the catalog lists charts that Red Hat provides, and administrators can add more charts for the whole cluster or for a single namespace. If you need only one or two charts, you can skip adding them to the catalog and install a chart directly from its URL instead. However, a chart that you install from a URL does not get the review that Red Hat and your administrators give catalog charts, so use this method only when you trust the source of the chart.
Charts that Red Hat or your administrators have not reviewed can introduce security risks to your cluster.
Prerequisites
- You have logged in to the Red Hat OpenShift Service on AWS web console.
- You have the necessary project permissions to install a Helm chart.
- You have a URL for a Helm chart.
Procedure
- In the Red Hat OpenShift Service on AWS web console, navigate to Ecosystem > Helm. The Helm view opens.
- In the Project drop-down menu, select the project where you want to install the Helm release; for example, default.
- From the Helm releases tab, click Create.
- Select Helm chart URL. The Install Helm chart from URL view opens.
In the Chart URL field, enter the URL for the Helm chart you want to install.
NoteFor Helm charts stored in an OCI-compliant registry, the URL must use the
oci://protocol; for example,oci://quay.io/organization/repository/chart-name.- In the Release name field, enter a name for the Helm release you want to install.
- In the Chart version field, enter the chart version number if the web console does not detect it automatically.
Optional: If the chart URL requires authentication, select a secret from the Secret for Basic authentication list. If the secret you need does not exist, create it:
- From the Secret for Basic authentication list, select Create Secret. The Create authentication Secret dialog opens.
- In the Secret name field, enter a unique name for the secret.
- Optional: In the Secret username field, enter the username for the chart URL.
- In the Secret password or token field, enter the password or token for the chart URL.
- Click Create. The web console selects the new secret in the Secret for Basic authentication list.
- Click Next. The Configure Helm release view opens.
- Review the configuration. Make sure that the Chart URL, Release name, and Version fields are correct.
For the Configure via option, select either Form view or YAML view.
- Choose Form view (the default) for a guided configuration of standard parameters.
Choose YAML view if you need to change advanced settings that are not available in Form view.
NoteThe Form view might not display every field from your Helm chart. If the chart does not include a values schema, Form view is unavailable and you must use YAML view. For full control over all configuration parameters, select YAML view.
- Click Install. The Helm releases tab opens and displays a status of Deployed if the installation succeeds.
Verification
- The Helm releases tab displays the new Helm release in the table.
- The Status column for the Helm release displays Deployed.
5.4.2. Upgrading a Helm release Copy linkLink copied to clipboard!
You can upgrade a Helm release to use a new chart version or update your release configuration.
Procedure
-
Navigate to Ecosystem
Helm. - Click the overflow menu in the release’s row and select Upgrade Helm release.
- On the Upgrade Helm release page, select the chart version you want, if available.
- Optional: If the release uses a chart URL that requires authentication, select a secret from the Secret for Basic authentication list. If you selected a secret when you installed the release, that secret is already selected. If that secret no longer exists, the page displays a notification, and you must select or create a different secret.
-
Edit the values as needed, then click Upgrade to create a revision of the Helm release. The Ecosystem
Helm page shows the updated revision count.
5.4.3. Roll back a Helm release Copy linkLink copied to clipboard!
If upgrading a release fails, you can roll back the Helm release to an earlier version.
Procedure
-
Navigate to Ecosystem
Helm. - Click the overflow menu in the release’s row and select Rollback.
- On the Rollback Helm Release page, select the Revision you want to roll back to and click Rollback.
-
On the Ecosystem
Helm page, click the chart to see the details and resources for that release. - Go to the Revision History tab to see all the revisions for the chart.
- Optional: Click the overflow menu next to a revision and select the revision to roll back to.
5.4.4. Deleting a Helm release Copy linkLink copied to clipboard!
You can delete a Helm release that you no longer need.
Procedure
-
Navigate to Ecosystem
Helm. - Click the overflow menu in the release’s row and select Delete Helm Release.
- In the confirmation prompt, enter the name of the release and click Delete.