Deploy to Red Hat OpenShift using Helm charts

Helm charts are a proven and useful tool for deploying several pieces of software applications to your Red Hat OpenShift cluster at the same time. This learning path will get you started with using Helm charts.

Set up your Developer Sandbox

With the Helm chart created and packaged, let’s now install it on your cluster.

Prerequisites:

  • Completion of the previous lessons.

In this lesson, you will:

  • Install a Helm chart.

If you haven’t already, get the GitHub repo associated with this lesson by running the following command:

git clone https://github.com/redhat-developer-demos/qotd-helm

Move into the ./qotd-system subdirectory.

Make sure you are logged in to your Developer Sandbox. Instructions for doing so can be found here: Logging into an OpenShift cluster | Red Hat Developer

After logging in to your Developer Sandbox, you can maximize this learning experience by putting OpenShift into Developer/Topology view and setting your browser to full screen mode. Then, position your terminal session window such that you can view most of the dashboard, as shown in Figure 1.

Red Hat OpenShift Dedicated dashboard with a separate terminal session window open covering approximately half the screen.
Figure 1: Position the terminal in front of the dashboard in order to see the deployments in action.

Start things by running this command:

helm install qotd-system ./qotd-system/charts/qotd-system-0.1.0.tgz

You will see the deployments and the two post-install jobs run in the background. When everything is finished, you will see instructions (from the NOTES.txt file) as to how to proceed:

After installation (helm install...) you'll need to set one or two environment variables.

1. REQUIRED: environment variable ##QOTD_API_URL## in deployment "qotd-website"
The value must be the URL of the qotd-backend service, appended with "/quotes/random"

For example:

oc set env deploy/qotd-website QOTD_API_URL=https://qotd-backend-userid-dev.apps.sandbox-m3.1530.p1.openshiftapps.com/quotes/random

After this, the qotd-website will replace the existing pod and any quotes supplied are hard-coded into the qotd-backend service.

2. OPTIONAL: environment variable USE_DB in deployment "qotd-backend"
This value must be set to "true" for the backend to switch from using hard-coded quotes to reading from the database.

For example:

oc set env deploy/qotd-backend USE_DB=true

That’s it. You have two apps and a database running in your cluster by way of one simple command.

Previous resource
Pack a Helm chart
Next resource
Upgrade via Helm chart