Habor安裝部署+SSL

Habor是由VMWare公司開源的容器鏡像倉庫。事實上,Habor是在Docker Registry上進行了相應的企業級擴展,從而獲得了更加廣泛的應用,這些新的企業級特性包括:管理用戶界面,基於角色的訪問控制 ,AD/LDAP集成以及審計日誌等,足以滿足基本企業需求。

官方地址:https://vmware.github.io

Github:https://github.com/goharbor/harbor

Habor安裝部署+SSL
Harbor主要功能

基於角色訪問控制(RBAC)
在企業中,通常有不同的開發團隊負責不同的項目,鏡像像代碼一樣,每個人角色不同需求也不同,因此就需要訪問權限控制,根據角色分配相應的權限。 
例如,開發人員需要對項目構建這就用到讀寫權限(push/pull),測試人員只需要讀權限(pull),運維一般管理鏡像倉庫,具備權限分配能力,項目經理具有所有權限。 
**鏡像複製**
可以將倉庫中的鏡像同步到遠程的Harbor,類似於MySQL主從同步功能。
**LDAP**
Harbor支持LDAP認證,可以很輕易接入已有的LDAP。
**鏡像刪除和空間回收**
Harbor支持在Web刪除鏡像,回收無用的鏡像,釋放磁盤空間。
**圖形頁面管理**
用戶很方面搜索鏡像及項目管理。
**審計**
對倉庫的所有操作都有記錄。
**REST API**
完整的API,方便與外部集成。

Harbor組件

組件 功能
harbor-adminserver 配置管理中心
harbor-db Mysql數據庫
harbor-jobservice 負責鏡像複製
harbor-log 記錄操作日誌
harbor-ui Web管理頁面和API
nginx 前端代理,負責前端頁面和鏡像上傳/下載轉發
redis 會話
registry 鏡像存儲

Harbor安裝有3種方式:

在線安裝:從Docker Hub下載Harbor相關鏡像,因此安裝軟件包非常小

離線安裝:安裝包包含部署的相關鏡像,因此安裝包比較大

OVA安裝程序:當用戶具有vCenter環境時,使用此安裝程序,在部署OVA後啓動Harbor

我們採用離線安裝,首先下載離線安裝包:https://github.com/goharbor/harbor/releases
1.添加docker的yum源,可以從阿里或騰訊等其他源地址
2.yum install -y docker-ce && systemctl enable docker && docker start docker
3.echo 1 >> /proc/sys/net/ipv4/ip_forward && source /proc/sys/net/ip4/ip_forward
4.curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
5. wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-online-installer-v1.9.0.tgz
[root@git_harbor ~]# tar -zxvf harbor-offline-installer-v1.9.0.tgz -C /usr/local/
[root@git_harbor ~]# mkdir /usr/local/harbor/ssl
[root@git_harbor ssl]# openssl genrsa -out ca.key 2048
Generating RSA private key, 2048 bit long modulus
..............................................................................................................................................................................+++
......................+++
e is 65537 (0x10001)
[root@git_harbor ssl]# openssl req -new -key ca.key -out ca.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:
State or Province Name (full name) []:
Locality Name (eg, city) [Default City]:
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:local.harbor.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@git_harbor ssl]# 
[root@git_harbor ssl]# openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
Signature ok
subject=/C=XX/L=Default City/O=Default Company Ltd/CN=local.harbor.com
Getting Private key
[root@git_harbor ssl]# vim ../harbor.yml
hostname: local.harbor.com
https:
   certificate: /usr/local/harbor/ssl/ca.crt
   private_key: /usr/local/harbor/ssl/ca.key
[root@git_harbor harbor]# ./prepare
[root@git_harbor harbor]# ./install.sh

6.修改server的hosts以及本機hosts
7.訪問Harbor
8.登錄harbor
docker login https://login.harbor.com/ -uadmin

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章