1、修改harbor配置文件
vim harbor.yml
chart:
# Change the value of absolute_url to enabled can enable absolute url in chart
absolute_url: enabled
2、停止harbor服务
docker-compose stop
3、注入配置
[root@localhost harbor]# ./prepare
4、安装chartmuseum
在执行install.sh安装脚本时,通过--with-chartmuseum参数安装chart插件。
[root@localhost harbor]# ./install.sh --with-notary --with-trivy --with-chartmuseum
5、验证
添加的命令
[root@k8s-master01 repo]# helm repo add --username=admin --password=xxxxxxxx 1quant_harbor https://xxxxx:8443/chartrepo/library
查看验证
[root@k8s-master01 ~]# helm repo list
NAME URL
1quant_harbor https://xxxx:8443/chartrepo/library
aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
三、推送和拉取chart
Helm 要想推送 Chart 到 Helm 仓库,需要提前安装上传插件:
helm plugin install https://github.com/chartmuseum/helm-push
#或者离线安装
mkdir /root/.local/share/helm/plugins/helm-push
cp helm-push_0.9.0_linux_amd64.tar.gz /root/.local/share/helm/plugins/helm-push
tar zxvf /root/.local/share/helm/plugins/helm-push/helm-push_0.9.0_linux_amd64.tar.gz
helm plugin list #查看
创建项目并推送chart到harbor
# 然后创建一个测试的 Chart 进行推送测试:
helm create hello-helm
# 打包chart,将chart打包成tgz格式
helm package hello-helm
#推送
helm cm-push hello-helm-0.1.0.tgz --username=admin --password=xxxxx
#拉取
helm pull --username=admin --password=xxxx 1quant_harbor/hello-helm
# 安装
helm install test-helm --username=admin --password=xxxxx --version 0.1.0 1quant_harbor/hello-helm
注意事项
在 Harbor 2.0 版本中,存储库仓库是不支持直接更新索引文件的。相比于传统的 Helm Chart 仓库,Harbor 更专注于容器镜像的存储和分发,因此在 Harbor 中并没有直接支持索引文件的更新功能。
如果你需要更新存储在 Harbor 中的 Helm Chart,可以通过以下方式来实现:
重新上传 Helm Chart: 首先,你需要在本地重新构建或修改 Helm Chart,并生成一个新的 .tgz
文件。然后,使用 helm push
命令将新的 Helm Chart 上传到 Harbor 中。
helm push mychart-1.0.0.tgz my-repo
其中,mychart-1.0.0.tgz
是新生成的 Helm Chart 文件,my-repo
是你在 Helm 中配置的 Harbor 存储库名称。
更新存储库: 上传新的 Helm Chart 后,你需要更新 Helm 存储库的索引文件。在本地执行以下命令:
helm repo update
这将从存储库中下载最新的索引文件,以使 Helm 可以获取到最新的可用 Chart。
需要注意的是,由于 Harbor 主要用于容器镜像管理,而不是传统的 Helm Chart 仓库,因此在更新 Helm Chart 时需要手动重新上传并更新索引文件。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有