Habor是由VMWare中国团队开源的容器镜像仓库。事实上,Habor是在Docker Registry上进行了相应的企业级扩展,从而获得了更加广泛的应用,这些新的企业级特性包括:管理用户界面,基于角色的访问控制 ,水平扩展,同步,AD/LDAP集成以及审计日志等。
 
一、部署Harbor
1: 安装docker-compose

 [root@node2 ~]# curl -L https://github.com/docker/compose/releases/download/1.17.0-rc1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
[root@node2 ~]# chmod !$
[root@node2 ~]# docker-compose -v docker-compose
version 1.17.-rc1, build a0f95af

2:下载harbor

GitHub下载地址:https://github.com/goharbor/harbor/releases

harbor下载地址:http://harbor.orientsoft.cn/

 [root@node2 src]# wget http://harbor.orientsoft.cn/harbor-v1.5.0/harbor-offline-installer-v1.5.0.tgz
[root@node2 src]# tar zxvf harbor-offline-installer-v1.5.0.tgz

3:准备ca证书

手动生成证书:https://www.cnblogs.com/douyi/p/11600719.html(参考1-5步骤即可)

注册免费证书:https://freessl.org/

4:配置harbor参数
[root@node2 src]# cd harbor
[root@node2 src]# vim harbor.cfg
修改下面的参数
hostname = harbor.test.com ##定义你的域名或者IP地址
ui_url_protocol = https ##定义访问方式
ssl_cert = /usr/local/src/server.crt ##定义证书crt的路径
ssl_cert_key = /usr/local/src/server.key ##定义证书key的路径
harbor_admin_password = harbor123 ##定义harbor管理员的密码

 
5:执行安装harbor
[root@node2 src]# sh install.sh

 [Step ]: checking installation environment ...

 Note: docker version: 18.09.

 Note: docker-compose version: 1.17.

 [Step ]: loading Harbor images ...
52ef9064d2e4: Loading layer [==================================================>] .9MB/.9MB
c169f7c7a5ff: Loading layer [==================================================>] .2MB/.2MB
a2194b3a5434: Loading layer [==================================================>] .75MB/.75MB
f3809b773329: Loading layer [==================================================>] .048kB/.048kB
bdd2cd4d5394: Loading layer [==================================================>] .13kB/.13kB
bce61638a813: Loading layer [==================================================>] .8MB/.8MB
Loaded image: vmware/clair-photon:v2.0.1-v1.5.0
0bf5fb4e60f4: Loading layer [==================================================>] 95MB/95MB
9fc876f7ef97: Loading layer [==================================================>] .656kB/.656kB
9f364ae08e7f: Loading layer [==================================================>] .048kB/.048kB
d8e3574f27f2: Loading layer [==================================================>] .68kB/.68kB
Loaded image: vmware/postgresql-photon:v1.5.0
8cb812a02f44: Loading layer [==================================================>] .25MB/.25MB
826629c35871: Loading layer [==================================================>] .36MB/.36MB
68fc630fcd08: Loading layer [==================================================>] .36MB/.36MB
Loaded image: vmware/harbor-adminserver:v1.5.0
fd8233cdfcf0: Loading layer [==================================================>] .25MB/.25MB
7ab0310b3d9d: Loading layer [==================================================>] .56kB/.56kB
75609935cf31: Loading layer [==================================================>] .56kB/.56kB
654b65c0f8ff: Loading layer [==================================================>] .048kB/.048kB
1da5c77da464: Loading layer [==================================================>] .8MB/.8MB
5e9191f65a4c: Loading layer [==================================================>] .8MB/.8MB
Loaded image: vmware/registry-photon:v2.6.2-v1.5.0
Loaded image: vmware/photon:1.0
454c81edbd3b: Loading layer [==================================================>] .2MB/.2MB
e99db1275091: Loading layer [==================================================>] .4MB/.4MB
051e4ee23882: Loading layer [==================================================>] .216kB/.216kB
6cca4437b6f6: Loading layer [==================================================>] .216kB/.216kB
1d48fc08c8bc: Loading layer [==================================================>] .68kB/.68kB
0419724fd942: Loading layer [==================================================>] .536kB/.536kB
543c0c1ee18d: Loading layer [==================================================>] .2MB/.2MB
4190aa7e89b8: Loading layer [==================================================>] .9kB/.9kB
Loaded image: vmware/harbor-migrator:v1.5.0
1736beaf11c8: Loading layer [==================================================>] .25MB/.25MB
3026403c0282: Loading layer [==================================================>] .39MB/.39MB
1aaf4a794824: Loading layer [==================================================>] .168kB/.168kB
b427e1a2dd17: Loading layer [==================================================>] .56MB/.56MB
68906d88fd96: Loading layer [==================================================>] .38MB/.38MB
Loaded image: vmware/harbor-ui:v1.5.0
cf8fe5c86f4b: Loading layer [==================================================>] .26MB/.26MB
d15d127e6aa2: Loading layer [==================================================>] .072kB/.072kB
9d47dbd3d824: Loading layer [==================================================>] .9kB/.9kB
098c90ca59f4: Loading layer [==================================================>] .95kB/.95kB
Loaded image: vmware/redis-photon:v1.5.0
71a9f645bc2d: Loading layer [==================================================>] .755MB/.755MB
Loaded image: vmware/nginx-photon:v1.5.0
c4c015394057: Loading layer [==================================================>] .3MB/.3MB
f9d78b9c2c97: Loading layer [==================================================>] .216kB/.216kB
5cf7df688ef1: Loading layer [==================================================>] .216kB/.216kB
9513efb6efc9: Loading layer [==================================================>] .68kB/.68kB
52252ffb5fc7: Loading layer [==================================================>] .536kB/.536kB
Loaded image: vmware/mariadb-photon:v1.5.0
243e37f674cb: Loading layer [==================================================>] .25MB/.25MB
eb85e1888b13: Loading layer [==================================================>] .95MB/.95MB
7b86ea27af2e: Loading layer [==================================================>] .3MB/.3MB
a876e7e90459: Loading layer [==================================================>] .87kB/.87kB
08c705395182: Loading layer [==================================================>] .072kB/.072kB
2cb9ada082da: Loading layer [==================================================>] .24MB/.24MB
Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.0
b9abce7219b5: Loading layer [==================================================>] .15MB/.15MB
ee87a4f06084: Loading layer [==================================================>] .584kB/.584kB
ca647be60b60: Loading layer [==================================================>] .072kB/.072kB
aeb4260dd4ca: Loading layer [==================================================>] .096kB/.096kB
4493e8c270cf: Loading layer [==================================================>] .584kB/.584kB
ce532e45f1e6: Loading layer [==================================================>] .728kB/.728kB
Loaded image: vmware/harbor-log:v1.5.0
4de8028cebd0: Loading layer [==================================================>] .78kB/.78kB
b762605dfab6: Loading layer [==================================================>] .56kB/.56kB
bed1e891c86f: Loading layer [==================================================>] .072kB/.072kB
Loaded image: vmware/harbor-db:v1.5.0
820ecb80c0fa: Loading layer [==================================================>] .25MB/.25MB
43ece8a3b461: Loading layer [==================================================>] .9MB/.9MB
e7ac4a143f8d: Loading layer [==================================================>] .9MB/.9MB
Loaded image: vmware/harbor-jobservice:v1.5.0
6ae72c7ad4ac: Loading layer [==================================================>] .16MB/.16MB
1ad34ba80481: Loading layer [==================================================>] .3MB/.3MB
f6ae3aed7f00: Loading layer [==================================================>] .87kB/.87kB
1b77c5882538: Loading layer [==================================================>] .072kB/.072kB
6364681eec7e: Loading layer [==================================================>] .46MB/.46MB
Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.0 [Step ]: preparing environment ...
Generated and saved secret to file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service. [Step ]: checking existing instance of Harbor ... [Step ]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ...
Creating harbor-log ... done
Creating redis ...
Creating registry ...
Creating harbor-db ...
Creating harbor-adminserver ...
Creating registry
Creating harbor-db
Creating redis
Creating harbor-adminserver ... done
Creating harbor-ui ...
Creating harbor-ui ... done
Creating harbor-jobservice ...
Creating nginx ...
Creating nginx
Creating nginx ... done ✔ ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at https://harbor.test.com.
For more details, please visit https://github.com/vmware/harbor

完成之后,通过docker-compose 命令查看到harbor运行相关信息

 [root@node2 harbor]# docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------------------------------------------
harbor-adminserver /harbor/start.sh Up
harbor-db /usr/local/bin/docker-entr ... Up /tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up 127.0.0.1:->/tcp
harbor-ui /harbor/start.sh Up
nginx nginx -g daemon off; Up 0.0.0.0:->/tcp, 0.0.0.0:->/tcp, 0.0.0.0:->/tcp
redis docker-entrypoint.sh redis ... Up /tcp
registry /entrypoint.sh serve /etc/ ... Up /tcp
6:web界面访问
##访问之前,先在访问的机器hosts文件中定义解析地址

新建一个项目test-tomcat

 
二、测试
1:拉取tomcat公共镜像

 [root@node2 src]# docker pull tomcat:9.0
9.0: Pulling from library/tomcat
844c33c7e6ea: Pull complete
ada5d61ae65d: Pull complete
f8427fdf4292: Pull complete
f025bafc4ab8: Pull complete
67b8714e1225: Pull complete
a78c0b398690: Pull complete
db8414d1baad: Pull complete
4fd8b5730f57: Pull complete
2985be663ca3: Pull complete
6c2146356687: Pull complete
[root@node2 src]# docker tag tomcat:9.0 harbor.test.com/test-tomcat/tomcat:9.0

2:把tomcat推送到harbor仓库里(首次上传,需要先通过docker login登录)

 [root@node2 src]# docker login https://harbor.test.com
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded
 [root@node2 src]# docker push harbor.test.com/test-tomcat/tomcat:9.0
The push refers to repository [harbor.test.com/test-tomcat/tomcat]
0c2c0181da75: Pushed
dd940d218ae3: Pushed
3254597aa3ac: Pushed
25efa461ccff: Pushed
4272c5799ff4: Pushed
9a11244a7e74: Pushed
5f3a5adb8e97: Pushed
73bfa217d66f: Pushed
91ecdd7165d3: Pushed
e4b20fcc48f4: Pushed
9.0: digest: sha256:ef41ad8f2e6119f71dad674d29b0edd28057eaf25be8786d3e259a1152d4fd25 size:

在web页面,项目里查看是否成功

kubernetes-部署harbor的更多相关文章

  1. kubernetes部署高可用Harbor

    前言 本文Harbor高可用依照Harbor官网部署,主要思路如下,大家可以根据具体情况选择搭建. 部署Postgresql高可用集群.(本文选用Stolon进行管理,请查看文章<kuberne ...

  2. kubernetes实战(十三):k8s使用helm持久化部署harbor集成openLDAP登录

    1.基本概念 上节在k8s中部署了harbor和ldap,本节将部署harbor使用openLDAP验证,部署方式与之前相同,只是改了adminserver-cm.yaml的AUTH_MODE: &q ...

  3. nuclio kubernetes 部署

    一张参考架构图: 从图中可以看到nuclio可以运行到docker 以及kubernetes中 提供了kubernetes 部署的脚本 安装 创建命名空间 kubectl create namespa ...

  4. kubernetes部署jenkins(Docker in Docker)及认证

    引言 Jenkins是一款开源 CI&CD 软件,用于自动化各种任务,包括构建.测试和部署软件. 本文将Jenkins的master与slave置于Pod中,部署在namespace:jenk ...

  5. kubernetes搭建Harbor无坑及Harbor仓库同步

    一.helm搭建harbor 1.安装helm 1.1.安装helm客户端 tar -zxvf helm-v2.14.3-linux-amd64.tar.gz mv linux-amd64/helm ...

  6. 部署 harbor 私有仓库

    安装下载依赖包 安装docker-compose 从 docker compose 发布页面下载最新的 docker-compose 二进制文件,本文以1.25.4为例 cd /opt/k8s/wor ...

  7. 部署harbor以https模式和k8s对接

    集群时间同步 我们在之前的kubeasz部署高可用kubernetes1.17.2 并实现traefik2.1.2部署篇已经实现了基于chrony的时间同步 [root@bs-k8s-master01 ...

  8. 群晖DS218+部署Harbor(1.10.3)

    欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...

  9. docker部署harbor私有镜像库(3)

    一.harbor介绍 在实际生产运维中,往往需要把镜像发布到几十.上百台或更多的节点上.这时单台Docker主机上镜像已无法满足,项目越来越多,镜像就越来越多,都放到一台Docker主机上是不行的,我 ...

  10. [系统集成] 基于Kubernetes 部署 jenkins 并动态分配资源

    基于kubernetes 部署 jenkins master 比较简单,难点是为 jenkins 动态分配资源.基于kubernetes 为 jenkins 动态分配资源需要实现下述功能: 资源分配: ...

随机推荐

  1. Linq 三表 left join 的实现

    目的实现: select id,name,jname,cname from userinfo u left join job j on u.job=j.jid left join city c on ...

  2. python 抓取youtube教程

    前言: 相信大家很多人都看过youtube网站上的视频,网站上有很多的优质视频,清晰度也非常的高,看到喜欢的想要下载到本地,虽然也有很多方法,但是肯定没有python 来的快, 废话不多说,上代码: ...

  3. ArcGIS API For Javascript:热力图不同级别下的优化方法

    我们在地图缩放的不同级别下,热力图的显示效果会不同,由于点密度与模糊参数默认是固定的,因此需要对参数进行动态修改,以满足不同缩放级别下可以得到较好的显示效果. 思路是监听地图缩放级别,将地图缩放级别作 ...

  4. 文件系统类型(ext4、xfs、fat32、vfat、ntfs、....)

    Linux 1.Linux:存在几十个文件系统类型:ext2,ext3,ext4,xfs,brtfs,zfs(man 5 fs可以取得全部文件系统的介绍) 不同文件系统采用不同的方法来管理磁盘空间,各 ...

  5. Nginx服务器安装及配置解释

    nginx是高性能的轻量级web服务器. 特性: 1.http代理 2.反向代理 3.负载均衡 4.缓存机制 一,安装及启动(centos7,nginx 1.14.0) 1.下载 wget http: ...

  6. python_08

    一.作业 ''' 主页: 图标地址.下载次数.大小.详情页地址 详情页: 游戏名.好评率.评论数.小编点评.下载地址.简介.网友评论.1-5张截图链接地址. https://www.wandoujia ...

  7. 从零开始入门 | Kubernetes 中的服务发现与负载均衡

    作者 | 阿里巴巴技术专家  溪恒 一.需求来源 为什么需要服务发现 在 K8s 集群里面会通过 pod 去部署应用,与传统的应用部署不同,传统应用部署在给定的机器上面去部署,我们知道怎么去调用别的机 ...

  8. [转载] Docker 实现原理

    目录 Namespaces 进程 网络 libnetwork 挂载点 chroot
 CGroups UnionFS 存储驱动 AUFS 其他存储驱动 总结 原文链接:https://dravenes ...

  9. firebug和HTML查看源代码的区别

    1.审查元素或者开发者工具或firebug看到的html是现在实时性的内容,经过js修改的: 2.而网页查看源代码看到的是最开始浏览器收到的HTTP响应,静态的html.

  10. Java多线程面试题:线程锁+线程池+线程同步等

    1.并发编程三要素? 1)原子性 原子性指的是一个或者多个操作,要么全部执行并且在执行的过程中不被其他操作打断,要么就全部都不执行. 2)可见性 可见性指多个线程操作一个共享变量时,其中一个线程对变量 ...