找回密码
 立即注册
首页 业界区 业界 Helm仓库管理

Helm仓库管理

仰翡邸 5 天前
概述

官方文档:https://helm.sh/zh/docs/topics/chart_repository/
官方仓库:https://artifacthub.io/
Helm 仓库(Repository)是存储 Helm 图表(Chart)的地方,类似于软件包管理器的仓库(如 apt、yum 仓库)。
Helm 仓库是一个 HTTP 服务器,用于存储和共享 Helm Chart 的压缩包(.tgz 文件)及相关索引文件(index.yaml)。
索引文件(index.yaml)记录了仓库中所有 Chart 的元数据(名称、版本、描述等),供 Helm 客户端查询和下载。
常见的仓库类型


  • 官方仓库:Helm 官方维护的仓库(已归档,现推荐使用 Artifact Hub 查找社区 Chart)。
  • 社区仓库:如 Bitnami、Jetstack 等组织提供的仓库。
  • 私有仓库:企业内部自建的仓库,用于管理私有 Chart。
常用的helm仓库

  • bitnami:https://charts.bitnami.com/bitnami
  • grafana:https://grafana.github.io/helm-charts
  • prometheus:https://prometheus-community.github.io/helm-charts
  • harbor:https://helm.goharbor.io
  • minio-operator:https://operator.min.io
Helm仓库管理常用配置

添加仓库

将仓库地址添加到 Helm 客户端的本地配置中
  1. # 语法
  2. helm repo add [仓库名称] [仓库地址]
  3. # 示例
  4. [root@master ~]# helm repo add prometheus https://prometheus-community.github.io/helm-charts
  5. "prometheus" has been added to your repositories
  6. [root@master ~]# helm repo add grafana https://grafana.github.io/helm-charts
  7. "grafana" has been added to your repositories
复制代码
更新仓库索引

Helm 客户端需要定期更新仓库索引,以获取最新的 Chart 列表和版本信息。
  1. [root@master ~]# helm repo update
  2. Hang tight while we grab the latest from your chart repositories...
  3. ...Successfully got an update from the "grafana" chart repository
  4. ...Unable to get an update from the "prometheus" chart repository (https://prometheus-community.github.io/helm-charts):
  5.         read tcp [fdbd:dc01:ff:318:3ebb:26f3:26ff:6026]:39074->[2606:50c0:8001::153]:443: read: connection reset by peer
  6. Update Complete. ⎈Happy Helming!⎈
复制代码
列出本地仓库

查看当前配置的所有仓库及其地址。
  1. [root@master ~]# helm repo list
  2. NAME            URL
  3. prometheus      https://prometheus-community.github.io/helm-charts
  4. grafana         https://grafana.github.io/helm-charts
复制代码
删除仓库(Remove Repository)

从本地配置中移除不再需要的仓库。
  1. #语法
  2. helm repo remove [仓库名称]
  3. # 示例
  4. [root@master ~]# helm repo remove grafana
  5. "grafana" has been removed from your repositories
  6. [root@master ~]# helm repo list
  7. NAME            URL                                               
  8. prometheus      https://prometheus-community.github.io/helm-charts
复制代码
搜索仓库中的 Chart(Search Charts)

从仓库中搜索符合条件的 Chart,支持模糊匹配。
  1. # 语法
  2. helm search repo [关键词]
  3. # 示例
  4. [root@master ~]# helm search repo grafana
  5. NAME                                    CHART VERSION   APP VERSION     DESCRIPTION                                       
  6. grafana/grafana                         9.2.2           12.0.1          The leading tool for querying and visualizing t...
  7. grafana/grafana-agent                   0.42.0          v0.42.0         Grafana Agent                                    
  8. grafana/grafana-agent-operator          0.5.1           0.44.2          A Helm chart for Grafana Agent Operator           
  9. grafana/grafana-operator                v5.18.0         v5.18.0         Helm chart for the Grafana Operator               
  10. grafana/grafana-sampling                1.1.5           v1.7.5          A Helm chart for a layered OTLP tail sampling a...
复制代码
查看指定仓库中Chart的版本
  1. # 语法
  2. helm search repo [chart名称] --versions
  3. # 示例
  4. [root@master ~]# helm search repo prometheus/kube-prometheus-stack --versions
  5. NAME                                    CHART VERSION   APP VERSION     DESCRIPTION                                       
  6. prometheus/kube-prometheus-stack        72.9.1          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  7. prometheus/kube-prometheus-stack        72.9.0          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  8. prometheus/kube-prometheus-stack        72.8.0          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  9. prometheus/kube-prometheus-stack        72.7.0          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  10. prometheus/kube-prometheus-stack        72.6.4          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  11. prometheus/kube-prometheus-stack        72.6.3          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  12. prometheus/kube-prometheus-stack        72.6.2          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  13. prometheus/kube-prometheus-stack        72.6.1          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  14. prometheus/kube-prometheus-stack        72.5.3          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  15. prometheus/kube-prometheus-stack        72.5.2          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  16. prometheus/kube-prometheus-stack        72.5.1          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  17. prometheus/kube-prometheus-stack        72.5.0          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  18. prometheus/kube-prometheus-stack        72.4.0          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
  19. prometheus/kube-prometheus-stack        72.3.1          v0.82.0         kube-prometheus-stack collects Kubernetes manif...
复制代码
拉取远程仓库的chart
  1. # 语法,--version对应的是chart version,--untar自动解压,
  2. # --destination:指定下载的 Chart 文件(.tgz)保存的目标目录(默认当前目录)。
  3. # --repo [仓库URL]        直接从指定 URL 下载 Chart,而不使用已添加的仓库名称。
  4. helm pull [chart名出] --version [版本号] --untar --destination [/path] --repo [仓库URL]
  5. # 示例
  6. [root@master ~]# helm pull prometheus/kube-prometheus-stack --version 72.9.0
  7. [root@master ~]# ll kube-prometheus-stack-72.9.0.tgz
  8. -rw-r--r-- 1 root root 814664 Jun  3 14:45 kube-prometheus-stack-72.9.0.tgz
复制代码
私有仓库相关命令

创建仓库索引文件

为本地 Chart 目录生成 index.yaml,用于搭建私有仓库。
  1. helm repo index [目录路径] --url [仓库URL]
复制代码
推送 Chart 到私有仓库
  1. helm push [Chart路径] [仓库名称]
复制代码
来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
您需要登录后才可以回帖 登录 | 立即注册