概述
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 客户端的本地配置中
| | | | --- | --- | | | # 语法 | | | helm repo add [仓库名称] [仓库地址] | | | | | | # 示例 | | | [root@master ~]# helm repo add prometheus https://prometheus-community.github.io/helm-charts | | | "prometheus" has been added to your repositories | | | [root@master ~]# helm repo add grafana https://grafana.github.io/helm-charts | | | "grafana" has been added to your repositories |
更新仓库索引
Helm 客户端需要定期更新仓库索引,以获取最新的 Chart 列表和版本信息。
| | | | --- | --- | | | [root@master ~]# helm repo update | | | Hang tight while we grab the latest from your chart repositories... | | | ...Successfully got an update from the "grafana" chart repository | | | ...Unable to get an update from the "prometheus" chart repository (https://prometheus-community.github.io/helm-charts): | | | read tcp [fdbdff:318:3ebb:26f3:26ff:6026]:39074->[2606:50c0:8001::153]:443: read: connection reset by peer | | | Update Complete. ⎈Happy Helming!⎈ |
列出本地仓库
查看当前配置的所有仓库及其地址。
| | | | --- | --- | | | [root@master ~]# helm repo list | | | NAME URL | | | prometheus https://prometheus-community.github.io/helm-charts | | | grafana https://grafana.github.io/helm-charts |
删除仓库(Remove Repository)
从本地配置中移除不再需要的仓库。
| | | | --- | --- | | | #语法 | | | helm repo remove [仓库名称] | | | | | | # 示例 | | | [root@master ~]# helm repo remove grafana | | | "grafana" has been removed from your repositories | | | [root@master ~]# helm repo list | | | NAME URL | | | prometheus https://prometheus-community.github.io/helm-charts |
搜索仓库中的 Chart(Search Charts)
从仓库中搜索符合条件的 Chart,支持模糊匹配。
| | | | --- | --- | | | # 语法 | | | helm search repo [关键词] | | | | | | # 示例 | | | [root@master ~]# helm search repo grafana | | | NAME CHART VERSION APP VERSION DESCRIPTION | | | grafana/grafana 9.2.2 12.0.1 The leading tool for querying and visualizing t... | | | grafana/grafana-agent 0.42.0 v0.42.0 Grafana Agent | | | grafana/grafana-agent-operator 0.5.1 0.44.2 A Helm chart for Grafana Agent Operator | | | grafana/grafana-operator v5.18.0 v5.18.0 Helm chart for the Grafana Operator | | | grafana/grafana-sampling 1.1.5 v1.7.5 A Helm chart for a layered OTLP tail sampling a... |
查看指定仓库中Chart的版本
| | | | --- | --- | | | # 语法 | | | helm search repo [chart名称] --versions | | | | | | # 示例 | | | [root@master ~]# helm search repo prometheus/kube-prometheus-stack --versions | | | NAME CHART VERSION APP VERSION DESCRIPTION | | | prometheus/kube-prometheus-stack 72.9.1 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.9.0 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.8.0 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.7.0 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.6.4 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.6.3 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.6.2 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.6.1 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.5.3 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.5.2 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.5.1 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.5.0 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.4.0 v0.82.2 kube-prometheus-stack collects Kubernetes manif... | | | prometheus/kube-prometheus-stack 72.3.1 v0.82.0 kube-prometheus-stack collects Kubernetes manif... |
拉取远程仓库的chart
| | | | --- | --- | | | # 语法,--version对应的是chart version,--untar自动解压, | | | # --destination:指定下载的 Chart 文件(.tgz)保存的目标目录(默认当前目录)。 | | | # --repo[仓库URL] 直接从指定 URL 下载 Chart,而不使用已添加的仓库名称。 | | | helm pull [chart名出]--version[版本号]--untar--destination[/path]--repo[仓库URL] | | | | | | # 示例 | | | [root@master ~]# helm pull prometheus/kube-prometheus-stack --version72.9.0 | | | [root@master ~]# ll kube-prometheus-stack-72.9.0.tgz | | | -rw-r--r--1 root root 814664 Jun 314:45 kube-prometheus-stack-72.9.0.tgz |
私有仓库相关命令
创建仓库索引文件
为本地 Chart 目录生成 index.yaml,用于搭建私有仓库。
| | | | --- | --- | | | helm repo index [目录路径] --url [仓库URL] |
推送 Chart 到私有仓库
| | | | --- | --- | | | helm push [Chart路径] [仓库名称] |
链接:https://www.cnblogs.com/huangSir-devops/p/18908212
全部0条评论
快来发表一下你的评论吧 !