1. 管理 Chart 仓库
现在你拥有了一个 Chart 仓库,最后一部分知道介绍如何下仓库中维护 Chart。
1.1. 添加一个新的 chart到已有仓库中
每次你想在仓库中添加一个新的 Chart 时,你必须重新生成 index。helm repo index
命令会完全无痕重建 index.yaml 文件。只包括在本地找到的 Chart。
不过你可以使用 --merge
参数增量添加新的 Chart 到现有 index.yaml 文件中(使用类似GCS的远程仓库时很有用)。执行 helm repo index --help
了解更多。
确保修订过的 index.yaml 文件和 chart 都上传了,如果生成了源文件,也要上传。
1.2. 与别人分享你的chart
准备好分享你的 chart 时,只需要告诉别人你的仓库地址就可以了。
他们会通过 helm repo add [NAME] [URL]
命令将仓库添加到他们的客户端,并使用想引用仓库的任何名称。
$ helm repo add fantastic-charts https://fantastic-charts.storage.googleapis.com
$ helm repo list
fantastic-charts https://fantastic-charts.storage.googleapis.com
[!NOTE|style:flat] 如果不存在有效的 index.yaml 就无法添加仓库。
如果chart支持HTTP的基础验证,你也需要提供用户名和密码:
$ helm repo add fantastic-charts https://fantastic-charts.storage.googleapis.com --username my-username --password my-password
$ helm repo list
fantastic-charts https://fantastic-charts.storage.googleapis.com
[!NOTE|style:flat] 如果你的 helm 仓库使用了类似于自签名的证书,为了跳过CA认证,可以使用
helm repo add --insecure-skip-tls-verify ...
然后,你的用户就可以通过你的 chart 进行搜索。更新了仓库之后,他们可以使用 helm repo update
命令获取最新的chart信息。
在内部 helm repo add
和 helm repo update
命令会检索 index.yaml 文件并将其存储在 $XDG_CACHE_HOME/helm/repository/cache/
目录中。这里是 helm search
方法查找chart信息的位置。