Kubernetes学习之路(28)之镜像仓库Harbor部署

Kubernetes学习之路(28)之镜像仓库Harbor部署

 

Harbor的部署

官方文档

Harbor有两种安装的方式:

1、环境需求

目标主机需要部署Docker和Docker-compose,以下为官方的软硬件要求:

硬件需求

资源容量推荐配置
CPU >= 2C >= 4C
Memory >= 4GB >= 8GB
Disk >= 40GB >= 160GB

软件需求

软件版本
Docker Engine >= 17.06.0-ce
Docker Compose >= 1.18.0
Openssl 最新版本

2、安装步骤

安装步骤归结为以下内容

  • (1)下载安装程序,并安装docker-compose;
  • (2)配置harbor.yml ;
  • (3)运行install.sh安装并启动Harbor;
# wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.2.tgz

# curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

# chmod +x /usr/local/bin/docker-compose 

# tar -zxf harbor-offline-installer-v1.8.2.tgz

# cd harbor && vim harbor.yml
hostname: 192.168.56.110		#更改hostname
harbor_admin_password: admin123    #更改harbor初始化密码,或者用默认账号密码admin Harbor12345,但是如果使用初始化密码,登录以后要立即更改,否则下次启动时,会无法进入harbor,别问为啥,这就是一个坑!!!


# ./install.sh
......
✔ ----Harbor has been installed and started successfully.----

Now you should be able to visit the admin portal at http://192.168.56.110. 
For more details, please visit https://github.com/goharbor/harbor .

3、登录Harbor UI

4、命令行登录

[root@k8s-master ~]# docker login 192.168.56.110
Username: admin
Password: 
Error response from daemon: Get https://192.168.56.110/v2/: dial tcp 192.168.56.110:443: connect: connection refused

有以下两种解决方案:

(1)在需要登陆的docker client端修改lib/systemd/system/docker.service文件,在里面修改ExecStart那一行,增加--insecure-registry=192.168.56.110,然后重启docker (systemctl daemon-reload systemctl restart docker)

(2)在harbor服务器端修改 /etc/docker/daemon.json(如果没有这个文件,自己建),修改后,同样运行 (systemctl daemon-reload systemctl restart docker)

posted @ 2020-09-28 11:09  CloudNativeBJ  阅读(130)  评论(0编辑  收藏  举报