harbor基于http和https的创建与使用

发布时间:2020-07-15 17:30:23 作者:派獭星
来源:网络 阅读:173

一·http方式

 harbor项目现托管在github上面,在此处以harbor v1.7.5为例演示。
  1·将harbor的二进制包下载到/usr/local/src目录下
  2·解压缩 tar xvf harbor.v.1.7.5.tar
  3·进如到解压harbor目录中,修改harbor.cfg文件

 1 ## Configuration file of Harbor
  2 
  3 #This attribute is for migrator to detect the version of the .cfg fil    e, DO NOT MODIFY!
  4 _version = 1.7.0
  5 #The IP address or hostname to access admin UI and registry service.
  6 #DO NOT use localhost or 127.0.0.1, because Harbor needs to be access    ed by external clients.
  7 #DO NOT comment out this line, modify the value of "hostname" directl    y, or the installation will fail.
  8 hostname = 192.168.238.7
  9 
 10 #The protocol for accessing the UI and token/notification service, by     default it is http.
 11 #It can be set to https if ssl is enabled on nginx.
 12 ui_url_protocol = http
 13 
 14 #Maximum number of job workers in job service  
 15 max_job_workers = 10 
 ...
 58 email_server = smtp.mydomain.com
 59 email_server_port = 25
 60 email_username = sample_admin@mydomain.com
 61 email_password = abc
 62 email_from = admin <sample_admin@mydomain.com>
 63 email_ssl = false
 64 email_insecure = false
 65 
 66 ##The initial password of Harbor admin, only works for the first time     when Harbor starts. 
 67 #It has no effect after the first launch of Harbor.
 68 #Change the admin password from UI after launching Harbor.
 69 harbor_admin_password = 123456

  主要修改hostname和adminpasswd。
  4·查看install.sh文件,查看安装harbor所需环境

#!/bin/bash

#docker version: 1.11.2 
#docker-compose version: 1.7.1 
#Harbor version: 0.4.0 

  此为最低版本要求,docker的安装可以在阿里镜像站按照步骤一步步安装,但是docker-compose若是要安装最新版本就需要下载python-pip一个类似yum或apt的工具,然后在使用pip install docker-compose安装即可
  5·运行install.sh脚本安装,至此,安装完成

二·https方式

 1·如上http方式部署。只是不用在docker的启动脚本中添加受信任的地址
 2.在harbor的安装目录下创建一个certs目录
mkdir certs
 3·生成私钥和公钥(注:公钥的地址要与harbor.cfg中的hostname相同)
openssl genrsa -out harbor-ca.key
touch /root/.rnd
openssl req -x509 -new -nodes -key harbor-ca.key -subj "/CN=harbor.magedu.net" -days 7120 -out harbor-ca.crt
 4·修改harbor.cfg配置文件

  1 ## Configuration file of Harbor
  2 
  3 #This attribute is for migrator to detect the version of the .cfg fil    e, DO NOT MODIFY!
  4 _version = 1.7.0
  5 #The IP address or hostname to access admin UI and registry service.
  6 #DO NOT use localhost or 127.0.0.1, because Harbor needs to be access    ed by external clients.
  7 #DO NOT comment out this line, modify the value of "hostname" directl    y, or the installation will fail.
  8 hostname = harbor.magedu.net
  9 
 10 #The protocol for accessing the UI and token/notification service, by     default it is http.
 11 #It can be set to https if ssl is enabled on nginx.
 12 ui_url_protocol = https
13 
 14 #Maximum number of job workers in job service  
 15 max_job_workers = 10 
 16 
 17 #Determine whether or not to generate certificate for the registry's     token.
 18 #If the value is on, the prepare script creates new root cert and pri    vate key 
 19 #for generating token to access the registry. If the value is off the     default key/cert will be used.
 20 #This flag also controls the creation of the notary signer's cert.
 21 customize_crt = on
 22 
 23 #The path of cert and key files for nginx, they are applied only the     protocol is set to https
 24 ssl_cert = /usr/local/src/harbor/certs/harbor-ca.crt
 25 ssl_cert_key = /usr/local/src/harbor/certs/harbor-ca.key
 26 
 *67 #It has no effect after the first launch of Harbor.
 68 #Change the admin password from UI after launching Harbor.
 69 harbor_admin_password = 123456
*

这个域名要有dns解析或者是hosts文件
 5·docker客户端分发公钥
mkdir -p /etc/docker/certs.d/(harbor.cfg中的hostname)
将harbor的公钥拷贝过来 /etc/docker/certs.d/(harbor.cfg中的hostname)重启docker即可

推荐阅读:
  1. HTTP与HTTPS简介
  2. Harbor 从http方式改为https方式

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

harbor rbo

上一篇:postgresql表去重的方法

下一篇:python关闭线程对的方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》