Skip to content

Helm examples

helm-cheatsheet.jpg

What is Helm?

Helm is a package manager for Kubernetes that allows you to manage Kubernetes resources as a single unit called a chart. A chart is a collection of YAML files that define a set of Kubernetes resources. Helm can install, upgrade, and delete charts, making it a powerful tool for managing Kubernetes applications.

How Does Helm Work?

Helm works by using a client-server architecture. The Helm client runs on your local machine and communicates with the Tiller server, which runs inside your Kubernetes cluster. When you run a Helm command, the client sends a request to the Tiller server, which then deploys the resources defined in the chart.

One of the most powerful features of Helm is the ability to use Helm Charts. Helm Charts are pre-configured packages that contain all the Kubernetes resources needed to run a specific application. This saves developers a lot of time since they don’t have to manually configure each resource for every deployment.

Benefits of Using Helm

Helm offers several benefits that make it an essential tool for Kubernetes developers. First, it helps to simplify the deployment of complex applications by bundling related resources into a single package. This reduces the risk of errors and saves time. Second, Helm allows you to create reusable packages that can be easily shared with other developers. Finally, Helm makes it easy to upgrade and rollback applications, ensuring that you can quickly respond to any issues that arise.

Helm Commands Summary

Below is the list of important Helm commands and their uses:

  • helm install: Installs a chart into the Kubernetes cluster and creates a release.
  • helm upgrade: Upgrades a release to a new version of a chart.
  • helm rollback: Rolls back a release to a previous revision. You can also roll back to a specific version.
  • helm list: Lists all releases.
  • helm status: Shows the status of any release.
  • helm uninstall: Deletes a release and removes all the resources deployed by the release in the Kubernetes cluster.
  • helm create: Creates a directory containing the common chart files and directories.
  • helm package: Packages a chart directory into a chart archive.
  • helm pull: Downloads a chart from Artifact Hub or a private repository to the current directory.
  • helm lint: Runs tests to check a chart and identify all possible issues.
  • helm history: Shows the release history of a specific chart.
  • helm template: Renders Kubernetes manifest files from a Helm chart without installing it.
  • helm show values: Displays the contents of the values.yaml file in a chart.
  • helm get values: Displays the custom values used in a specific release.
  • helm env: Shows information about the Helm client environment, including the Kubernetes cluster context and Helm version.
  • helm repo add: It adds a repository from the chart in Artifact Hub or private registry.
  • helm repo list: It lists all the chart repositories.
  • helm repo update: It fetches the latest information about charts locally from the configured repositories.
  • helm repo remove: It removes one or more chart repositories.
  • helm repo index: It creates an index.yaml file for a chart repository.
  • helm repo show: It displays the information about the chart repository.
  • helm search repo: It searches for the repository in Helm charts with the specified name.
  • helm search hub: It searches for the charts in Artifact Hub or private registry.

Get started

alias helm="helm --kubeconfig=$HOME/tmp/kubeconfig.yaml"
## or put config into "$HOME/.kube/config"

Add repo

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

Warm up commands

helm repo update
helm repo list

helm install bitnami/mysql --dry-run
helm install bitnami/mysql --generate-name

helm show chart bitnami/mysql

helm list
helm list --all

helm uninstall mysql-1612624192

helm status mysql-1612624192

helm search hub
helm search repo

helm install happy-panda bitnami/wordpress
helm status happy-panda
helm show values bitnami/wordpress

helm get hooks
helm get manifest
helm get notes
helm get values
helm get all

helm env

Upgrade & rollback

helm get values happy-panda
echo 'mariadb.auth.username: user1' > panda.yaml
helm upgrade -f panda.yaml happy-panda bitnami/wordpress
helm get values happy-panda
helm rollback happy-panda 1
helm history happy-panda -n default

Package sources

The helm install command can install from several sources:

  • A chart repository (as we’ve seen above)
  • A local chart archive (helm install foo foo-0.1.1.tgz)
  • An unpacked chart directory (helm install foo path/to/foo)
  • A full URL (helm install foo https://example.com/charts/foo-1.2.3.tgz)
helm lint web-ping

helm repo add stable https://charts.helm.sh/stable
helm install --set service.type=LoadBalancer --set service.externalPort=8008 --set env.open.DISABLE_API=false repo stable/chartmuseum --version 2.13.0 --wait
helm repo add local $(kubectl get svc repo-chartmuseum -o jsonpath='http://{.status.loadBalancer.ingress[0].*}:8008')

# pack
helm package web-ping

# upload zip
curl --data-binary "@web-ping-0.1.0.tgz" $(kubectl get svc repo-chartmuseum -o jsonpath='http://{.status.loadBalancer.ingress[0].*}:8008/api/chart s')

# check index
curl $(kubectl get svc repo-chartmuseum -o jsonpath='http://{.status.loadBalancer.ingress[0].*}:8008/index.yaml')

helm repo update
helm search repo web-ping

Reference

  • https://helm.sh
  • Learning Helm (Matt Butcher, Matt Farina, and Josh Dolitsky)
  • https://artifacthub.io
  • Learn Kubernetes in a Month of Lunches (ELTON STONEMAN)
  • Get helm: https://github.com/bpbpublications/Kubernetes-for-Jobseekers/blob/main/get_helm.sh
Leave Your Message