腾讯云负载均衡 https代理harbor

桃扇骨 2022-09-11 14:11 269阅读 0赞

因为种种原因, 被迫采用云负载均衡代理harbor, 使用负载均衡的https方式代理访问后端的http协议的harbor ,证书配置到负载均衡上,如下:

user——>slb(HTTPs)–>harbor(http) —> core/protal/registry

部署Harbor镜像仓库

安装docker与docker-compose

这一步骤不知道操作的,自行百度

下载Harbor离线包部署

  1. # tar zxvf harbor-offline-installer-v2.0.0.tgz
  2. # cd harbor
  3. # cp harbor.yml.tmpl harbor.yml
  4. # vi harbor.yml

如果你已经安装请删除掉harbaor目录, 重新解压;
不要执行./prepare
不要执行./iinstall.sh

使用这种方式我们配置harbor.yml文件时,需要把https段配置注释,否则会发生http自动重定向到https,导致循环重定向,

配置hostname 设置为负载均衡ip对应的外网域名
harbor.wxadt.cn 是我的负载均衡的域名
配置如图

  1. # The IP address or hostname to access admin UI and registry service.
  2. # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
  3. # 配置hostname 设置为负载均衡ip对应的外网域名
  4. hostname: harbor.wxadt.cn
  5. # http related config
  6. # http开启 https注释掉
  7. http:
  8. # port for http, default is 80. If https enabled, this port will redirect to https port
  9. port: 80
  10. # https related config
  11. #https:
  12. # https port for harbor, default is 443
  13. # port: 443
  14. # The path of cert and key files for nginx
  15. # certificate: /your/certificate/path
  16. # private_key: /your/private/key/path

配置代理域名

  1. external_url: https://harbor.wxadt.cn

好执行 ./prepare ./install.sh

  1. [root@lnt-gitlab2 ~]# ./prepare
  2. [root@lnt-gitlab2 ~]# ./install.sh

等待服务启动ok
访问 admin IU 界面 https://harbor.wxadt.cn 结果正常
在这里插入图片描述
在本地使用 docker login harbor.wxadt.cn 也是ok, 但是push报错;

push报错:unauthorized: unauthorized to access repository(unauthorized: authentication required) 或者日志里面报错:unknown blob

头大,解决方法

第一步.停harbor服务

  1. docker-compose down

.修改nginx配置

编辑 harbor.yml目前下的common/config/nginx/nginx.conf , 注释掉所有的 proxy_set_header X-Forwarded-Proto $scheme;
在这里插入图片描述

启动

  1. docker-compose up -d

发表评论

表情:
评论列表 (有 0 条评论,269人围观)

还没有评论,来说两句吧...

相关阅读

    相关 部署https请求

    因为苹果公司要求所有的API接口都必须要https的,所以没办法只能升级一下。现在阿里和腾讯的证书都还不错。这里记录一下腾讯云部署HTTPS的整个过程期间遇到了很多问题。在这里

    相关 反向代理负载均衡

    反向代理: > 有一群服务器集群,并且服务器集群中的每台服务器内容一样时,我们要直接从个人电脑访问到服务器集群服务器的时候无法访问,必须通过第三方服务器才能访问集群。通过