Raul Naupari
raulnq

raulnq

Useful commands for Helm

Useful commands for Helm

Raul Naupari's photo
Raul Naupari
·Apr 30, 2022·

4 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Table of contents

  • Helm core concepts
  • Helm commands

Helm is an open source package manager for Kubernetes. It provides the ability to provide, share, and use software built for Kubernetes.

In this post, we are going to cover the most common Helm command (and its most common parameters) from our day-to-day work and a brief review of the core concepts. You can review the official documentation here.

Helm core concepts

  • The Chart is a Helm package that contains information sufficient for installing a set of Kubernetes resources into a Kubernetes cluster.

  • The Repository is a simple HTTP server to store collection of charts. You can search, download and install charts from a repository.

  • The Release is an instance or a deployment of a chart. When you perform a helm install command, you are creating a new release of that chart on your Kubernetes cluster.

Helm commands

Repository management

List chart repositories:

helm repo list
helm repo list
NAME            URL
bitnami         https://charts.bitnami.com/bitnami
ingress-nginx   https://kubernetes.github.io/ingress-nginx

Search for charts in the local repositories:

helm search repo [keyword]
helm search repo rabbitmq
NAME                                    CHART VERSION   APP VERSION     DESCRIPTION
bitnami/rabbitmq                        9.0.0           3.9.16          RabbitMQ is an open source general-purpose mess...
bitnami/rabbitmq-cluster-operator       2.6.0           1.12.1          The RabbitMQ Cluster Kubernetes Operator automa...

Search for charts in the Artifact Hub:

helm search hub [keyword] -o yaml
helm search hub jaeger -o yaml
- app_version: 1.17.1
  description: A Jaeger Helm chart for Kubernetes
  repository:
    name: hkube
    url: https://hkube.io/helm/
  url: https://artifacthub.io/packages/helm/hkube/jaeger
  version: 0.27.2006
- app_version: 1.30.0
  description: A Jaeger Helm chart for Kubernetes
  repository:
    name: jaegertracing
    url: https://jaegertracing.github.io/helm-charts
  url: https://artifacthub.io/packages/helm/jaegertracing/jaeger
  version: 0.56.1

Add a repository:

helm repo add [repository] [repository-url]
helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
"jaegertracing" has been added to your repositories

Update information of charts in local repositories:

helm repo update
helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "jaegertracing" chart repository

Chart management

Using packages created by us

Create a directory containing the common chart files and directories:

helm create [chart]
helm create demo-app
Creating demo-app

Examine a chart for possible issues:

helm lint [chart]
helm lint demo-app
==> Linting demo-app
[INFO] Chart.yaml: icon is recommended

Upgrade a release:

helm upgrade [release] [chart]
--namespace           namespace scope for this request
--install             if a release by this name doesn't already exist, run an install
--dry-run             simulate an upgrade
--debug               enable verbose output
--values              specify values in a YAML file or a URL (can specify multiple)
--set                 set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
--create-namespace    if --install is set, create the release namespace if not present
helm upgrade release-demo demo-app --debug --install --values values.local.yaml --set image.tag=1.0.0

Package a chart directory into a chart archive:

helm package [chart] --app-version
helm package demo-app --app-version 1.0.0
Successfully packaged chart and saved it to: C:\demo-app-1.0.0.tgz

Push a chart to a remote repository (depending on the server):

Using packages from a remote repository

Show the chart's definition:

helm show chart [chart]
helm show chart ingress-nginx/ingress-nginx
apiVersion: v2
appVersion: 1.2.0
description: Ingress controller for Kubernetes using NGINX as a reverse proxy and
  load balancer
home: https://github.com/kubernetes/ingress-nginx
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Nginx_logo.svg/500px-Nginx_logo.svg.png
keywords:
- ingress
- nginx
kubeVersion: '>=1.19.0-0'
maintainers:
- name: rikatz
- name: strongjz
- name: tao12345666333
name: ingress-nginx
sources:
- https://github.com/kubernetes/ingress-nginx
type: application
version: 4.1.0

Show the chart's values:

helm show values [chart]

Download a chart from a repository:

helm pull [chart]
helm pull ingress-nginx/ingress-nginx

Install a chart:

helm install [release] [chart]
helm install ingress-nginx/ingress-nginx

Release management

List releases:

helm list --namespace [namespace]
helm list --namespace default
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS  CHART                   APP VERSION
release-demo    default         3               2022-04-27 14:09:35.2202953 -0500 -05   failed  demo-app-1.0.0          1.16.0

Fetch release history:

helm history [release]
helm history release-demo
REVISION        UPDATED                         STATUS          CHART                   APP VERSION     DESCRIPTION
1               Wed Apr 27 08:52:02 2022        superseded      demo-app-0.1.0          1.16.0          Upgrade complete
2               Wed Apr 27 12:53:03 2022        deployed        demo-app-0.1.0          1.16.0          Upgrade complete
3               Wed Apr 27 14:09:35 2022        failed          demo-app-1.0.0          1.16.0          Upgrade "demo-app" failed: pre-upgrade hooks failed: timed out waiting for the condition

Rollback a release to a previous revision:

helm rollback [release] [revision]
helm rollback demo-app 2
Rollback was a success! Happy Helming!

Uninstall a release:

helm uninstall [release]
helm uninstall demo-app
release "demo-app" uninstalled
 
Share this