Purpose
To understand How to use helm chart in Kubernetes
Helm chart directory structure
wordpress/
Chart.yaml # A YAML file containing information about the chart
LICENSE # OPTIONAL: A plain text file containing the license for the chart
README.md # OPTIONAL: A human-readable README file
values.yaml # The default configuration values for this chart
values.schema.json # OPTIONAL: A JSON Schema for imposing a structure on the values.yaml file
charts/ # A directory containing any charts upon which this chart depends.
crds/ # Custom Resource Definitions
templates/ # A directory of templates that, when combined with values,
# will generate valid Kubernetes manifest files.
templates/NOTES.txt # OPTIONAL: A plain text file containing short usage notes
Find helm chart - helm search
helm search repo/hub [chartname]
필요한 helm chart가 있는 경우 해당 chart가 포함된 repo를 helm에 추가하고 사용할 수 있다.
e.g. prometheus를 kubernetes에 설치하고 싶은 경우 아래와 같이 repo를 먼저 추가한뒤 helm search 명령어로 필요한 chart를 다운 받아서 사용할 수 있다.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
## helm repo에서 prometheus chart 찾기
helm search repo prometheus
Download and install helm chart - helm fetch and install
Before install helm chart, you can change values.yaml file what you want
helm fetch [helmchart]
helm install [helmchart] .[chart-path] -n [namespace]
helm uninstall [helmchart] -n [namespace]
## example
helm fetch prometheus-community/prometheus
helm install my-prometheus -f ./values.yaml . -n monitoring
helm uninstall my-prometheus -n monitoring
Option
- template debug
- lint : verify template and dependencies
- --dry-run : you can see template yaml files and error
1. helm lint prometheus-operator
2. helm install prometheus-operator . --dry-run
Helm upgrade - After edit value.yaml
helm upgrade -n prometheus prometheus -f ./values.yaml ./
helm history -n prometheus prometheus
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Fri Apr 2 13:17:14 2021 superseded prometheus-operator-9.3.2 0.38.1 Install complete
2 Fri Apr 2 13:24:14 2021 deployed prometheus-operator-9.3.2 0.38.1 Upgrade complete
Rollback helm chart
When you have some problem in your helm chart you can rollback your deploy
helm history [releasename]
helm rollback [releasename] [versionnumber-with-status-deployed]
helm rollback prometheus 5
If you don't want to remove resource such as pvc
metadata:
annotations:
"helm.sh/resource-policy": keep
[...]
'Cloud-native > Kubernetes' 카테고리의 다른 글
[Kubernetes]Nginx-Ingress custom errors page (0) | 2022.05.28 |
---|---|
[Kubernetes]Pull an Image from a Private Registry with Secret in Kubernetes (0) | 2022.05.28 |
[Kubernetes]Install helm in CentOS (0) | 2022.05.23 |
[Kubernetes]What is RBAC in Kubernetes? (Role based access control) (0) | 2022.05.22 |
[Kubernetes]Use TLS certificates as secret in Kubernetes (0) | 2022.05.21 |