Harbor 是一個主流的鏡像倉庫系統,在 v1.6 版本以后的 harbor 中新增加了 helm charts 的管理功能,可以存儲Chart文件。
1 啟用Harbor的Chart倉庫服務
# 這里在 harbor 服務器上操作
# cd /usr/local/harbor/
# ./install.sh --with-chartmuseum
啟用后,默認項目就帶有helm charts功能了。我這里創建一個名為lc_chart的私有倉庫。
2 安裝push插件
(1) 我這里使用的 helm 版本為 helm-v3.7.1,helm 中已經集成了 push 插件,但是由於 helm 版本過高導致 helm 集成的 push 插件
不能連接 harbor 倉庫,我這里使用二進制版本的 push 插件。
參考: https://github.com/chartmuseum/helm-push/issues/109
(2) heml push 插件二進制安裝
# helm push插件的 github 項目地址
https://github.com/chartmuseum/helm-push
1) 在線安裝
# helm plugin install https://github.com/chartmuseum/helm-push
2) 離線安裝
# wget https://github.com/chartmuseum/helm-push/releases/download/v0.10.1/helm-push_0.10.1_linux_amd64.tar.gz
# mkdir -p helm-push/
# tar -xzf helm-push_0.10.1_linux_amd64.tar.gz -C helm-push/
# 查看 helm 插件的存放路徑
# helm env
......
HELM_PLUGINS="/root/.local/share/helm/plugins"
# 創建插件目錄
# mkdir -p /root/.local/share/helm/plugins
# 復制插件到插件目錄
# cp -a helm-push/ /root/.local/share/helm/plugins/
3 添加repo
# helm repo add harbor_lc_chart --username admin --password Harbor12345 http://172.16.1.61/chartrepo/lc_chart
# helm repo update
# helm repo list
NAME URL
harbor_lc_charthttp://172.16.1.61/chartrepo/lc_chart
4 推送與安裝Chart
(1) 推送
1) 帶用戶名、密碼、倉庫url推送
# helm cm-push demo-0.1.0.tgz --username admin --password Harbor12345 http://172.16.1.61/chartrepo/lc_chart
Pushing demo-0.1.0.tgz to http://172.16.1.61/chartrepo/lc_chart...
Done.
2) 根據本地添加認證的倉庫推送
# helm cm-push demo-0.1.0.tgz harbor_lc_chart
Pushing demo-0.1.0.tgz to harbor_lc_chart...
Done.
(2) 查看推送到harbor上的chart
(3) 部署Chart
1) 下載后部署
# helm pull --version 0.1.0 harbor_lc_chart/demo
# helm install web demo-0.1.0.tgz -n default
2) 在線部署
# helm install web --version 0.1.0 harbor_lc_chart/demo -n default


