helm
Package manager for kubernetes
Helm
packages multiple kubernetes resources in a single deployment logical object calledChart
Helm
offers a dependency management
Glossary
- a
Helm Chart
is a package that contains multiple k8s resources (Deployments
,Configmaps
,Services
,Ingress
, …) - a
Release
is an instance of aChart
- a
Registry
is a collection ofChart
- a
Template
is a k8s resource model using the Golang templating engine and the librarySprig
Chart
https://helm.sh/docs/topics/charts/
Chart project structure
$ helm create hello-world
$ tree
.
|-- Chart.yaml
|-- values.yaml
|-- charts/
| `-- redis-10.2.1.tgz
`-- templates/
|-- NOTES.txt
|-- _helpers.tpl
|-- hasher.yaml
|-- rng.yaml
|-- serviceaccount.yaml
|-- webui.yaml
`-- worker.yaml
- Chart.yaml: This is the main file that contains the description of our chart
- values.yaml: this is the file that contains the default values for our chart
- templates: This is the directory where Kubernetes resources are defined as templates
- charts: This is an optional directory that may contain sub-charts
- .helmignore: This is where we can define patterns to ignore when packaging (similar in concept to .gitignore)
chart.yaml
apiVersion: The chart API version (required)
name: The name of the chart (required)
version: A SemVer 2 version (required)
kubeVersion: A SemVer range of compatible Kubernetes versions (optional)
description: A single-sentence description of this project (optional)
type: The type of the chart (optional)
keywords:
- A list of keywords about this project (optional)
home: The URL of this projects home page (optional)
sources:
- A list of URLs to source code for this project (optional)
dependencies: # A list of the chart requirements (optional)
- name: The name of the chart (nginx)
version: The version of the chart ("1.2.3")
repository: (optional) The repository URL ("https://example.com/charts") or alias ("@repo-name")
condition: (optional) A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled )
tags: # (optional)
- Tags can be used to group charts for enabling/disabling together
import-values: # (optional)
- ImportValues holds the mapping of source values to parent key to be imported. Each item can be a string or pair of child/parent sublist items.
alias: (optional) Alias to be used for the chart. Useful when you have to add the same chart multiple times
maintainers: # (optional)
- name: The maintainers name (required for each maintainer)
email: The maintainers email (optional for each maintainer)
url: A URL for the maintainer (optional for each maintainer)
icon: A URL to an SVG or PNG image to be used as an icon (optional).
appVersion: The version of the app that this contains (optional). Needn't be SemVer. Quotes recommended.
deprecated: Whether this chart is deprecated (optional, boolean)
annotations:
example: A list of annotations keyed by name (optional).
Public Kubernetes package registry
Useful commands
# update to latest charts
helm repo update
# add repo
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# list charts from a repo
helm search repo prometheus-community
# install a chart
helm install prometheus-community/prometheus --generate-name
# list helm releases
helm list
helm ls
# show configurable options with detailed comments
helm show values prometheus-community/prometheus
# check helm release status
helm status prometheus
# uninstall a releases
helm uninstall grafana
# upgrading a release
helm upgrade grafana grafana/grafana --set ingress.enabled=true