harbor helm仓库使用

harbor helm仓库使用

官方文档地址:https://github.com/goharbor/harbor

Monocular 从1.0 开始专注于helm 的UI展示,对于部署以及维护已经去掉了,官方也提供了相关的说明以及推荐了几个可选的部署工具,从使用以及架构上来说kubeapps 就是Monocular + helm 操作的集合,比Monocular早期版本有好多提升

安装

  • 下载离线安装包
wget https://github.com/goharbor/harbor/releases/download/v1.9.3/harbor-offline-installer-v1.9.3.tgz
  • 配置harbor

主要是harbor.cfg文件
目前主要配置hostname和port ,使用自己服务器的ip,修改默认端口号

hostname: 192.168.75.100
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 10000
  • docker-compose相关
# 先安装docker-compose,地址:https://github.com/docker/compose/releases
# 需要docker-compose(1.18.0+)版本
curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

# 查看docker-compose版本
[root@ks-allinone harbor]# docker-compose version
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

# 安装
./install.sh   --with-clair --with-chartmuseum
# 安装helm
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash

# 安装push 插件
helm init 
helm plugin install https://github.com/chartmuseum/helm-push

# 查看安装的插件
helm plugin list
NAME    VERSION DESCRIPTION                      
push    0.7.1   Push chart package to ChartMuseum


# 添加harbor helm 私服
# 首先需要创建项目myrepo(当前设计的模式为public)
# chartrepo是必备的,不可缺少,不然就会推送到默认的library上面去了

helm repo add --username=admin --password=Harbor12345 myrepo http://192.168.75.100:10000/chartrepo/myrepo
"myrepo" has been added to your repositories

# or 添加特定仓库
helm repo add --username=admin --password=Harbor12345 myrepo https://xx.xx.xx.xx/chartrepo/myproject

# 创建demo
helm create app

	Creating app

# 推送到harbor,push
helm push --username=admin --password=Harbor12345 app myrepo
	Pushing app-0.1.0.tgz to myrepo...
	Done.

Kubeapps应用商店显示Harbor仓库的helm

登陆Kubeapps后,点击右上角"Configuration"的"App Repositories",出来的界面就是各个仓库地址

点击"Add App Repository",Name字段填写"myrepo",URL字段填写"http://192.168.75.100:10000/chartrepo/myrepo"
Authorization字段选择"Basic Auth",在右边出现的界面填写上登陆Harbor仓库的账号和密码,最后点击"Install Repo",添加后的效果:

然后返回登陆首页,点击"Catalog",在搜索框中输入Harbor仓库中添加的helm,比如"app",就会显示出来

原文地址:https://www.cnblogs.com/sanduzxcvbnm/p/11944506.html