Skip to main content

Install from Helm charts

Helm is a popular package manager for Kubernetes. A Helm chart is a bundle of parameterizable YAML resources for Kubernetes/OpenShift.

Difference with Operators

Helm charts can be defined as Operators (if they are packaged using the operator-sdk), but they are not all Operators.

See the official documentation for Helm on OpenShift.

Install the Helm client

Install Golang

Go lang is required to run Helm. Install go 1.14.4 on Linux, you can find instructions for MacOS, Windows and newer versions at https://golang.org/dl

wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz

# Extract to /usr/local
tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz

# Add Go to path in .profile
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
# Or in .zshrc if you use ZSH
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.zshrc

Restart your laptop for the changes to take effects or execute source ~/.profile

Install Helm

You can also use the official documentation to install Helm on your machine.

Install on Linux

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

See Helm documentation for Linux.

Install on MacOS

brew install helm

See Helm documentation for MacOS.

Install on Windows

Install using Chocolatey.

choco install kubernetes-helm

See Helm documentation for Windows.

Check Helm installation

helm version

Install a Helm chart

Explore published Helm charts at https://hub.helm.sh ⛵

Start a MySQL database with Helm

Example from the OpenShift 4.3 documentation. See also the official Helm documentation.

  1. Add the repository of official Helm charts to your local Helm client:
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
  1. Update the repository:
helm repo update
  1. Install an example MySQL chart, and start the application named example-mysql:
helm install example-mysql stable/mysql
Password

The instructions to retrieve the admin password and connect to the database will be displayed in the terminal.

Retrieve the database password with this command (N.B.: kubectl can also be used in place of oc):

oc get secret example-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo
  1. Verify that the chart has installed successfully:
helm list
  1. Expose the MySQL service as a route:
oc expose service example-mysql
oc get routes

Or port-forward to http://localhost:3306

oc port-forward svc/example-mysql 3306

Uninstall the application

helm uninstall example-mysql

Set deployment parameters

You can also define deployment parameters when installing a Helm chart, such as the service account and node selector.

For example, here we make sure the application will run on DSRI CPU nodes and use the anyuid service account:

Add Bitnami repository:

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

Install and start Postgresql:

helm install postgresql-db bitnami/postgresql --set nodeSelector.dsri.unimaas.nl/cpu=true --set serviceAccount.name=anyuid