Difficulty: beginner
Estimated Time: 20 minutes

Goal

Learn how to use the Helm, a package manager that helps you managing and deploying applications on OpenShift.

Logo

Helm is a package manager for Kubernetes which helps users create templated packages called Helm Charts to include all Kubernetes resources that are required to deploy a particular application. Helm then assists with installing the Helm Chart on Kubernetes, and afterwards it can upgrade or rollback the installed package when new versions are available.

Helm 3 is GA and available on OpenShift 4.4, removing Tiller depencies like in Helm 2 which was source of major security concerns.

Concepts

  • Helm core concepts
  • Exploring helm command line tool
  • Deploying and managing Helm Charts
  • Creating your own Chart
  • Managing applications lifecycle with Helm Upgrade and Rollback of releases.
  • Helm integrations with OpenShift UI

Use case

Be able to provide a great experience for both Developers and System Administrators to manage and deploy applications using Helm Charts on top of OpenShift.

Helm Charts are particularly useful for installation and upgrade of stateless applications given that the Kubernetes resources and the application image can simply be updated to newer versions. The follow-up for this Day 1 experience, is to convert Helm Charts into an Operator, using Operator Framework for a complete Day 2 experience for your apps.

This OpenShift cluster will self-destruct in one hour.

Let's get started!

Summary

In this workshop, you have worked with OpenShift and learned about how Helm 3 integration helps developers to deploy and run applications.

As follow-up of this workshop, we recommend the Operator SDK with Helm workshop, also available as self-paced lab.

We hope you have found this workshop helpful in learning about Helm on OpenShift, and would love any feedback you have on ways to make it better! Feel free to open issues in this workshop’s GitHub repository.

To learn more about Helm, the resources below can provide information on everything from getting started to more advanced concepts.

Helm Documentation: https://helm.sh

Getting Started with Helm 3 on OpenShift: https://docs.openshift.com/container-platform/4.4/cli_reference/helm_cli/getting-started-with-helm-on-openshift-container-platform.html

Read more in the Developers blog: https://developers.redhat.com/blog/2020/04/30/application-deployment-improvements-in-openshift-4-4/

Try it out on your workstation! Download CodeReady Containers to have a local instance of OpenShift Container Platform 4 where to run Helm Charts: https://www.openshift.com/try

Getting Started with Helm 3 on OpenShift

Step 1 of 3

Explore Helm CLI

At the end of this chapter you will be able to:

  • Use helm CLI
  • Install helm repository
  • Search, install and uninstall Helm Charts
  • Review Helm Charts from OpenShift Console

Helm Command Line Interface (CLI)

In this scenario you will find the Helm CLI already installed for you, which can be also retrieved from OpenShift Console, top right corner, click on ? -> Command Line Tools.

The CLI is the entry point for any interaction with Helm 3 subsystem. In addition to that, OpenShift Developer Catalog, which is the central hub for all developer content, has support for Helm Charts in addition to Operator-backed services, Templates, etc.

When a user instructs the Helm CLI to install a Helm Chart, the information about the Helm Chart is fetched from the repository, rendered on the client and then applied to Kubernetes while a record of this installation is created within the namespace (which is known as a Release).

Helm on OpenShift

Logging in to the Cluster

To login to the OpenShift cluster from the Terminal run:

oc login -u developer -p developer

This will log you in using the credentials:

  • Username: developer
  • Password: developer

Use the same credentials to log into the Web Console.

Create a new OpenShift Project to have a namespace for our helm charts to work with.

oc new-project helm

Exercise: Explore CLI

Let's get started by using helm getting CLI version :

helm version

This should confirm we are using Helm 3.

As discussed in the previous step, Helm Charts are available through repositories, and those can be pre-installed or installable by the user.

You can search for Helm Charts available in any public repositories through Helm Hub.

For instance, searching Helm Charts for NGINX:

helm search hub nginx

This will give a list of available charts from multiple repositories. If we want to install it, we need to have such repositories configured.

By default the list of available repositories is empty. You can add a new one with the CLI. For NGINX, add Bitnami repository:

helm repo add bitnami https://charts.bitnami.com/bitnami

Once added, verify it is present:

helm repo list

You can search for Helm Charts also inside repos, like in the one you just installed:

helm search repo bitnami/nginx

Deploy a Helm Chart

You can use helm install command to deploy your charts and start managing revisions.

To install NGINX Chart:

helm install my-nginx bitnami/nginx --set service.type=ClusterIP

This will install nginx, and for this example, we want to use ClusterIP Service type because we want to expose it afterwards through an OpenShift Route.

Check your Helm releases:

helm ls

Verify all the pods are in Running state and Ready:

oc get pods

Now expose my-nginx service to access it via OpenShift Route:

oc expose svc/my-nginx

Verify that route has been created:

oc get routes

You can click on the generated host to access the NGINX Pod provided by your just installed Helm Chart, or you can do it from OpenShift Console.

Verify the deployment from OpenShift Console

To verify the creation of the resources generated by the Helm Chart, you can head out to the OpenShift web console.

You can make your way to the web console by clicking on the Console tab next to the Terminal tab at the center top of the workshop in your browser.

You need to log in with username developer and password developer.

Make sure the Developer perspective from the dropdown in the top left corner of the web console is selected as shown below:

Next, select the Project dropdown menu shown below and choose helm project you have been working with.

Next, click on the Topology tab on the left side of the web console if you don't see what's in the image below. Once in the Topology view, you can see the Deployment for my-nginx application and you can access it by clicking on the URL generated by the OpenShift Route:

You'll notice the HR label and Helm icon below, this means that this application is managed by Helm, and you can overview Helm Releases for this app from left side menu, Helm section:

Explore all Resources that are associated with a particular Helm Release, click on my-nginx Helm Release and then click on Resouces tab:

Uninstall and clean

Come back to Terminal clicking on Terminal tab.

Uninstall my-nginx release:

helm uninstall my-nginx

Delete previously created route:

oc delete route my-nginx