harbor管理helm-charts

1. harbor管理helm-charts

1.1. 版本信息

1
2
3
4
harbor version: 1.8.1
helm version: v3.6.2
docker version: 18.06.3
docker-compose version: 1.25.4

1.2. 安装chartmuseum插件

harbor 安装的时候 默认没有helm charts的仓库

1
2
docker-compose stop
./install.sh --with-chartmuseum

安装完成之后登录页面上就会有了 helm charts 了,页面上也可以直接上传charts

1.3. helm 安装push插件

1
2
3
4
5
6
7
# 安装插件
helm plugin install https://github.com/chartmuseum/helm-push

# 查看
[root@k8s-master ~]# helm plugin list
NAME VERSION DESCRIPTION
cm-push 0.10.1 Push chart package to ChartMuseum

创建一个charts项目

1.4. 添加仓库

1
2
3
4
helm repo add harbor https://harbor.xxx.com/chartrepo/library

# 如需要配置用户名密码
helm repo add harbor --username=xxx --password=xxx https://harbor.xxx.com/chartrepo/library

查看

1
2
3
4
5
[root@k8s-master ~]# helm repo list
NAME URL
bitnami https://charts.bitnami.com/bitnami
ingress-nginx https://kubernetes.github.io/ingress-nginx
harbor http://harbor.aimm.cn/chartrepo/library

1.5. 上传到仓库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 查找charts
[root@k8s-master ~]# helm search repo redis
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/redis 15.0.4 6.2.5 Open source, advanced key-value store. It is of...
bitnami/redis-cluster 6.3.6 6.2.5 Open source, advanced key-value store. It is of...

# 下载到本地
[root@k8s-master ~]# helm pull bitnami/redis
[root@k8s-master ~]# ls redis-15.0.4.tgz
redis-15.0.4.tgz

# 上传到私有仓库
[root@k8s-master ~]# helm cm-push --username=admin --password=Harbor12345 redis-15.0.4.tgz harbor
Pushing redis-15.0.4.tgz to harbor...
Done.

上传完成后到harbor仓库查看

强制推送

1
2
3
[root@k8s-master ~]# helm cm-push --force redis-15.0.4.tgz harbor 
Pushing redis-15.0.4.tgz to harbor...
Done.

直接推送到URL

1
2
3
[root@k8s-master ~]# helm cm-push redis-15.0.4.tgz https://harbor.xxx.com/chartrepo/library
Pushing redis-15.0.4.tgz to https://harbor.xxx.com/chartrepo/library
Done.

1.6. 报错解决:

1
2
3
4
5
[root@k8s-master ~]# helm cm-push redis-15.0.4.tgz harbor
Pushing redis-15.0.4.tgz to harbor...
Error: 401: could not properly parse response JSON: {"code":401,"message":"Unauthorized"}
......
Error: plugin "cm-push" exited with error

添加用户名密码即可。

-------------本文结束感谢您的阅读-------------