Helm is a package manager for Kubernetes that allows developers and operators to more easily configure and deploy applications on Kubernetes clusters.
In this tutorial, you will set up Helm 3 and use it to install, reconfigure, rollback, and delete an instance of the Kubernetes Dashboard application. The dashboard is an official web-based Kubernetes GUI.
For a conceptual overview of Helm and its packaging ecosystem, please read our article, An Introduction to Helm.
For this tutorial you will need:
- A Kubernetes cluster with role-based access control (RBAC) enabled. Helm 3.1 supports clusters from versions 1.14 to 1.17. For further information check the Helm releases page.
kubectlcommand-line tool installed on your local machine, configured to connect to your cluster. You can read more about installing
kubectlin the official documentation.
You can test your connectivity with the following command:
If you see no errors, you’re connected to the cluster. If you access multiple clusters with
kubectl, be sure to verify that you’ve selected the correct cluster context:
- kubectl config get-contexts
OutputCURRENT NAME CLUSTER AUTHINFO NAMESPACE * do-fra1-helm3-example do-fra1-helm3-example do-fra1-helm3-example-admin
In this example the asterisk (
*) indicates that we are connected to the
do-fra1-helm3-examplecluster. To switch clusters run:
- kubectl config use-context context-name
When you are connected to the correct cluster, continue to Step 1 to begin installing Helm.
Step 1 — Installing Helm
First, you’ll install the
helm command-line utility on your local machine. Helm provides a script that handles the installation process on MacOS, Windows, or Linux.
Change to a writable directory and download the script from Helm’s GitHub repository:
- cd /tmp
- curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
Make the script executable with
You can use your favorite text editor to open the script and inspect it to make sure it’s safe. When you are satisfied, run it:
You may be prompted for your password. Provide it and press
ENTER to continue.
The output will look like this:
OutputDownloading https://get.helm.sh/helm-v3.1.2-linux-amd64.tar.gz Preparing to install helm into /usr/local/bin helm installed into /usr/local/bin/helm
Now that you’ve got Helm installed, you’re ready to use Helm to install your first chart.
Step 2 — Installing a Helm Chart
Helm software packages are called charts. There is a curated chart repository called stable, mostly consisting of common charts, which you can see in their GitHub repo. Helm does not come preconfigured for it, so you’ll need to manually add it. Then, as an example, you are going to install the Kubernetes Dashboard.
stable repo by running:
- helm repo add stable https://kubernetes-charts.storage.googleapis.com
The output will be:
Output"stable" has been added to your repositories
helm to install the
kubernetes-dashboard package from the
- helm install dashboard-demo stable/kubernetes-dashboard --set rbac.clusterAdminRole=true
--set parameter lets you to customize chart variables, which the chart exposes to allow you to customize its configuration. Here, you set the
rbac.clusterAdminRole variable to
true to grant the Kubernetes Dashboard access to your whole cluster.
The output will look like:
OutputNAME: dashboard-demo LAST DEPLOYED: Tue Mar 31 15:04:19 2020 NAMESPACE: default STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: ...
NAME line, highlighted in the above example output. In this case, you specified the name
dashboard-demo. This is the name of the release. A Helm release is a single deployment of one chart with a specific configuration. You can deploy multiple releases of the same chart, each with its own configuration.
You can list all the releases in the cluster:
The output will be similar to this:
OutputNAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION dashboard-demo default 1 2020-03-31 15:04:19.324774799 +0000 UTC deployed kubernetes-dashboard-1.10.1 1.10.1
You can now use
kubectl to verify that a new service has been deployed on the cluster:
The output will look like this:
OutputNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dashboard-demo-kubernetes-dashboard ClusterIP 10.245.115.214 <none> 443/TCP 4m44s kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 19m
Notice that by default, the service name corresponding to the release is a combination of the Helm release name and the chart name.
Now that you’ve deployed the application, you’ll use Helm to change its configuration and update the deployment.
Step 3 — Updating a Release
helm upgrade command can be used to upgrade a release with a new or updated chart, or update its configuration options (variables).
You’re going to make a simple change to the
dashboard-demo release to demonstrate the update and rollback process: you’ll update the name of the dashboard service to just
kubernetes-dashboard, instead of
kubernetes-dashboard chart provides a
fullnameOverride configuration option to control the service name. To rename the release, run
helm upgrade with this option set:
- helm upgrade dashboard-demo stable/kubernetes-dashboard --set fullnameOverride="kubernetes-dashboard" --reuse-values
By passing in the
--reuse-values argument, you make sure that chart variables you’ve previously
set do not get reset by the upgrade process.
You’ll see output similar to the initial
helm install step.
Check if your Kubernetes services reflect the updated values:
The output will look like the following:
OutputNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 38m kubernetes-dashboard ClusterIP 10.245.49.157 <none> 443/TCP 8s
Notice that the service name has been updated to the new value.
Note: At this point you may want to actually load the Kubernetes Dashboard in your browser and check it out. To do so, first run the following command:
This creates a proxy that lets you access remote cluster resources from your local computer. Based on the previous instructions, your dashboard service is named
kubernetes-dashboard and it’s running in the
default namespace. You may now access the dashboard at the following URL:
Instructions for actually using the dashboard are out of scope for this tutorial, but you can read the official Kubernetes Dashboard docs for more information.
Next, you’ll have a look at Helm’s ability to roll back and delete releases.
Step 4 — Rolling Back and Deleting a Release
When you updated the
dashboard-demo release in the previous step, you created a second revision of the release. Helm retains all the details of previous releases in case you need to roll back to a prior configuration or chart.
helm list to inspect the release again:
You’ll see the following output:
OutputNAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 2 Wed Aug 8 20:13:15 2018 DEPLOYED kubernetes-dashboard-0.7.1 default
REVISION column tells you that this is now the second revision.
helm rollback to roll back to the first revision:
- helm rollback dashboard-demo 1
You should see the following output, indicating that the rollback succeeded:
OutputRollback was a success! Happy Helming!
At this point, if you run
kubectl get services again, you will notice that the service name has changed back to its previous value. Helm has re-deployed the application with revision 1’s configuration.
Helm releases can be deleted with the
helm delete command:
- helm delete dashboard-demo
The output will be:
Outputrelease "dashboard-demo" uninstalled
You can try listing Helm releases:
You’ll see that there are none:
OutputNAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
Now the release has been truly deleted, and you can reuse the release name.
In this tutorial, you installed the
helm command-line tool and explored installing, upgrading, rolling back, and deleting Helm charts and releases by managing the
For more information about Helm and Helm charts, please see the official Helm documentation.