前言
笔者在规划服务容器化的过程中,对镜像管理有一些思考,最终决定使用Harbor管理镜像;
在局域网搭建Harbor私有仓库,在构建镜像的服务器中构建好服务镜像,并且将镜像传上harbor中,那么测试及开发环境只需要拉取镜像运行,即完成服务的更新:
部署过程
修改hosts文件
笔者以下使用的域名hub.domain.com
,并不是实际注册的域名,而是通过修改Hosts文件指向了这个Harbor服务器的地址,你可以修改为自己需要的域名。
[root@harbor ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.43 hub.domain.com
创建为Harbor使用Https的CA证书
-
创建证书存放目录
[root@harbor ~]# mkdir -p /data/cert [root@harbor ~]# cd /data/cert/
-
获得证书授权
[root@harbor cert]# openssl genrsa -out ca.key 4096 [root@harbor cert]# openssl req -x509 -new -nodes -sha512 -days 3650 \ -subj "/C=CN/ST=Guangzhou/L=Guangzhou/O=example/CN=hub.domain.com" \ -key ca.key \ -out ca.crt
-
获得证书服务器
# 创建私钥 [root@harbor cert]# openssl genrsa -out hub.domain.com.key 4096 # 生成证书签名 [root@harbor cert]# openssl req -sha512 -new \