harbor安装高可用
harbor架构
下载地址https://github.com/goharbor/harbor/
高可用架构
解压压缩包
tar -xvf harbor-offline-installer-v1.10.3.tgz
进入harbor目录修改配置文件
执行sh install.sh安装harbor
通过nginx进行负载实现高可用
user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } stream { upstream hub { server 172.17.166.217:80; #server 172.17.166.218:80; } server { listen 80; proxy_pass hub; proxy_timeout 300s; proxy_connect_timeout 5s; } }
创建nginx启动脚本
docker stop harbornginx docker rm harbornginx docker run -idt --net=host --name harbornginx -p 80:80 -v /soft/nginx:/etc/nginx nginx:1.17.7
修改容器镜像地址
docker
{ "insecure-registries": ["172.17.166.217"] }
containerd
vim /etc/containerd/config.toml [plugins."io.containerd.grpc.v1.cri".registry] [plugins."io.containerd.grpc.v1.cri".registry.mirrors] [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"] endpoint = ["https://registry-1.docker.io"] [plugins."io.containerd.grpc.v1.cri".registry.mirrors."172.17.166.217"] endpoint = ["http://172.17.166.217"] [plugins."io.containerd.grpc.v1.cri".registry.configs] [plugins."io.containerd.grpc.v1.cri".registry.configs."172.17.166.217".auth] username = "admin" password = "1.Q1.Q1.Q"
docker 登录验证 docker login 172.17.166.217
harbor创建用户
将用户添加到项目中
双方创建访问地址及凭证
双方添加复制选项
可选立即同步及事件驱动实现双主互备