HELM 包管理器
约 3 分钟阅读
Helm
- helm/helmGitHubhelm/helmhelm/helm 是什么 · Kubernetes 上的包管理器 · helm.sh · 环境变量列表 · nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helm笔记:HELM 包管理器 是什么
- Kubernetes 上的包管理器
- helm.sh链接helm.shhelm/helm 是什么 · Kubernetes 上的包管理器 · helm.sh · 环境变量列表 · nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helm笔记:HELM 包管理器
- 环境变量列表链接helm.sh/docs/helm/helmhelm/helm 是什么 · Kubernetes 上的包管理器 · helm.sh · 环境变量列表 · nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helm笔记:HELM 包管理器
- nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helmGitHubsonatype-nexus-community/nexus-repository-helmhelm/helm 是什么 · Kubernetes 上的包管理器 · helm.sh · 环境变量列表 · nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helm笔记:HELM 包管理器
- 注意
- 3.0 过后没有 tiller 了
- HELM 可以单纯的作为模板引擎来使用 - 但是失去了 helm 管理注册应用的能力
- 如果用作模板引擎,那还可以选择 Kustomize, k8comp, kdeploy, ktmpl, kuku, jinja, sed, awk, gotpl
- 失去的能力: 清单分组、应用或包依赖、查看集群安装应用、注册应用、应用版本回滚
- 仓库不是必要的,一个 helm charts 就是一个 tgz
- 相同版本可重复安装,revision 会有变化,本地开发时经常这样
- 参考
- Helm Charts Best Practices链接jfrog.com/blog/helm-charts-best-practiceshelm/helm 是什么 · Kubernetes 上的包管理器 · helm.sh · 环境变量列表 · nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helm笔记:HELM 包管理器
- HELM Best practices链接codefresh.io/docs/docs/new-helm/helm-best-practiceshelm/helm 是什么 · Kubernetes 上的包管理器 · helm.sh · 环境变量列表 · nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helm笔记:HELM 包管理器
- Chart.yaml
- arttor/helmifyGitHubarttor/helmifyhelm/helm 是什么 · Kubernetes 上的包管理器 · helm.sh · 环境变量列表 · nexus 可通过插件支持 helm sonatype-nexus-community/nexus-repository-helm笔记:HELM 包管理器
brew install helm
# 客户端版本
helm version
helm repo add stable http://mirror.azure.cn/kubernetes/charts/
helm search repo stable
helm show values stable/nextcloud
helm pull stable/nextcloud
helm pull stable/nextcloud --untar
# 安装本地 chart
helm install --namespace apisix -f values.yaml apisix ./
helm create my-chart路径
| 系统 | 缓存 | 配置 | 数据 |
|---|---|---|---|
| Linux | $HOME/.cache/helm | $HOME/.config/helm | $HOME/.local/share/helm |
| macOS | $HOME/Library/Caches/helm | $HOME/Library/Preferences/helm | $HOME/Library/helm |
| Windows | %TEMP%\helm | %APPDATA%\helm | %APPDATA%\helm |
- /
- cache/
- archive/
- plugins/
- repository/
- repositories.lock
- repositories.yaml
- cache/
- ${NAME}-index.yaml
- local/
- index.yaml
- starters/
- cache/
常用仓库
| NAME | URL |
|---|---|
| wener offcial collection | wenerme.github.io/charts charts.wener.tech |
| traefik | containous.github.io/traefik-helm-chart |
| jetstack | charts.jetstack.io |
| hashicorp | helm.releases.hashicorp.com |
| harbor | helm.goharbor.io |
| bitnami | charts.bitnami.com/bitnami |
| Deprecaed | ⚠️ |
| stable | kubernetes-charts.storage.googleapis.com |
| incubator | kubernetes-charts-incubator.storage.googleapis.com |
| stable azure mirror | mirror.azure.cn/kubernetes/charts |
| incubator azure mirror | mirror.azure.cn/kubernetes/charts-incubator |
- bitnami/chartsGitHubbitnami/chartssocat-tunneller · Sentry Charts · Reloader - Watch changes in ConfigMap and Secrets and restart pods. · Bitnami Charts · DandyDeveloper Charts笔记:Kubernetes Helm Charts
- banzaicloud/banzai-chartsGitHubbanzaicloud/banzai-charts
- helm/chartsGitHubhelm/charts
仓库
- The Chart Repository Guide
- HTTP
- 提供 index.yaml 访问
- helm/chartmuseumGitHubhelm/chartmuseum
- Golang chart 仓库
- 支持较多后端 - 主要的有
- S3
- 阿里云 OSS
- Minio
- 支持上传
- 支持认证GitHubhelm/chartmuseum
- Helm 支持 Registry 来存储 charts
- 推送遇到问题 - insufficient_scope: authorization failed #6214GitHub Issuehelm/helm#6214
- 不能推送到 docker hub #5861GitHub Issuehelm/helm#5861
index.yaml
local
helm repo reindex local-repochartmuseum
# 本地存储
docker run --rm -it \
-p 8080:8080 \
-e DEBUG=1 \
-e STORAGE=local \
-e STORAGE_LOCAL_ROOTDIR=/charts \
-v $(pwd)/charts:/charts \
--name chartmuseum chartmuseum/chartmuseum:latest
# UI
# https://github.com/chartmuseum/ui
docker run --rm -it \
-p 80:8080 \
-e CHART_MUSESUM_URL: http://chartmuseum:8080 \
--link chartmuseum:chartmuseum \
--name chartmuseumui idobry/chartmuseumui:latest# Aliyun OSS
# ALIBABA_CLOUD_ACCESS_KEY_ID
# ALIBABA_CLOUD_ACCESS_KEY_SECRET
chartmuseum --debug --port=8080 \
--storage="alibaba" \
--storage-alibaba-bucket="my-oss-bucket" \
--storage-alibaba-prefix="" \
--storage-alibaba-endpoint="oss-cn-beijing.aliyuncs.com"registry
# < 3.8.0
export HELM_EXPERIMENTAL_OCI=1
helm registry login -u myuser index.docker.io
# 推送到服务器
helm push argo-cd-5.45.1.tgz oci://index.docker.io/wcharts/
helm pull oci://index.docker.io/wcharts/argo-cd:5.45.1
# 推送新的 tgz
# https://hub.docker.com/u/wcharts
# ls -tr -l --time-style=+"%Y-%m-%d %H:%M:%S" | awk '{print $6, $7, $8}' | tail # 最新的
LAST=$(ls -lt | grep ^- | head -n1 | awk '{print $NF}')
git pull
# https://hub.docker.com/r/wcharts/sealed-secrets/tags
find . -iname '*.tgz' -newer $LAST | xargs -I {} -n 1 helm push {} oci://index.docker.io/wcharts
find . -type f -newermt 2017-09-24
find . -type f -newerat 2017-09-25name: argocd
apiVersion: v2
dependencies:
- name: argo-cd
version: 5.45.1
repository: oci://registry-1.docker.io/wcharts
version: 1.0.0repo
helm repo add --username=admin myrepo https://xx.xx.xx.xx
# helm plugin install https://github.com/chartmuseum/helm-push
helm push hello-helm-0.1.0.tgz myrepoHelm 模板
# https://helm.sh/docs/chart_template_guide/
helm install --debug --dry-run goodly-guppy ./mychart
# 渲染单个模板 - 用于测试排查问题
helm template ./mychart --show-only templates/values.yaml > values.yaml
# 渲染整个 chart
helm template ./mychartHelm Operator
FAQ
oci registry vs chart repository
- OCI
- 实验阶段
- 可直接使用现有 Docker 仓库基础设施
- 仓库方可能对 chart 支持还不是很好 - Chart 元信息可能展现不完善
- 部分仓库还不支持
- Helm 3+
- Repo
- Helm 2+
- 简单易理解 - HTTP 静态文件服务 - 提供 index.yaml 作为索引
- 现有仓库功能相对完善
helm repo index merge
- helm repo index --merge 需要不同的目录才能生效
- #4482GitHub Issuehelm/helm#4482
# 方案A: copy 目录
cp -r charts last
# update charts
helm repo index --merge last/index.yaml charts
# 方案B: 存储在别的位置
helm repo index --merge charts/index.yaml newer
rsync newer/ charts/unpacked charts cannot be verified
关联信息
反向链接、本文链接的其他页面和外部资料。
反向链接
- K8S Awesome笔记 · Helm
cncf landscape · awesome-cloud-native · Service Mesh / Cloud Native · GoogleCloudPlatform/scion · Google Cloud Platform 相关的 Go 项目。
参考资料
GitHub11 条
- helm/chartmuseumgithub.com/helm/chartmuseum
- arttor/helmifygithub.com/arttor/helmify
- banzaicloud/banzai-chartsgithub.com/banzaicloud/banzai-charts
- bitnami/chartsgithub.com/bitnami/charts
- fluxcd/helm-operatorgithub.com/fluxcd/helm-operator
- helm/chartsgithub.com/helm/charts
- helm/helmgithub.com/helm/helm
- helm/helm#4482github.com/helm/helm/issues/4482
- helm/helm#5861github.com/helm/helm/issues/5861
- helm/helm#6214github.com/helm/helm/issues/6214
- sonatype-nexus-community/nexus-repository-helmgithub.com/sonatype-nexus-community/nexus-repository-helm
依赖包1 条
- text/templatepkg.go.dev/text/template
其他外链19 条
- helm.sh/docs/topics/chart_repositoryhelm.sh/docs/topics/chart_repository
- charts.bitnami.com/bitnamicharts.bitnami.com/bitnami
- charts.jetstack.iocharts.jetstack.io/
- charts.wener.techcharts.wener.tech/
- codefresh.io/docs/docs/new-helm/helm-best-practicescodefresh.io/docs/docs/new-helm/helm-best-practices
- containous.github.io/traefik-helm-chartcontainous.github.io/traefik-helm-chart
- helm.goharbor.iohelm.goharbor.io/
- helm.releases.hashicorp.comhelm.releases.hashicorp.com/
- helm.shhelm.sh/
- helm.sh/docs/helm/helmhelm.sh/docs/helm/helm
- helm.sh/docs/topics/chartshelm.sh/docs/topics/charts
- helm.sh/docs/topics/registrieshelm.sh/docs/topics/registries
- jfrog.com/blog/helm-charts-best-practicesjfrog.com/blog/helm-charts-best-practices
- kubernetes-charts-incubator.storage.googleapis.comkubernetes-charts-incubator.storage.googleapis.com/
- kubernetes-charts.storage.googleapis.comkubernetes-charts.storage.googleapis.com/
- masterminds.github.io/sprigmasterminds.github.io/sprig
- mirror.azure.cn/kubernetes/chartsmirror.azure.cn/kubernetes/charts
- mirror.azure.cn/kubernetes/charts-incubatormirror.azure.cn/kubernetes/charts-incubator
- wenerme.github.io/chartswenerme.github.io/charts