Redirect 为什么我会得到;“禁止”;当我试图使用HAProxy重定向CentOS Docker容器中安装的CRC调用时的状态?

Redirect 为什么我会得到;“禁止”;当我试图使用HAProxy重定向CentOS Docker容器中安装的CRC调用时的状态?,redirect,containers,openshift,haproxy,codeready,Redirect,Containers,Openshift,Haproxy,Codeready,我有这样一个场景: 运行Debian的主机,运行docker容器 CentOS docker容器,其自身安装了CodeReady容器(CRC)。CRC通过命令行在容器上工作,没有问题 我想从主机访问在https://console-openshift-console.apps-crc.testing(位于容器的主机文件中的特定IP上) 我找到了这个 并且,应用于Docker容器,对haproxy.conf进行以下更改: global log 127.0.0.1 local0 debug

我有这样一个场景:

  • 运行Debian的主机,运行docker容器
  • CentOS docker容器,其自身安装了CodeReady容器(CRC)。CRC通过命令行在容器上工作,没有问题
我想从主机访问在
https://console-openshift-console.apps-crc.testing
(位于容器的
主机
文件中的特定IP上)


我找到了这个

并且,应用于Docker容器,对
haproxy.conf
进行以下更改:

global
log 127.0.0.1 local0
debug

defaults
log global
mode http
timeout connect 5000
timeout check 5000
timeout client 30000
timeout server 30000

frontend apps
bind CONTAINER_IP:80
bind CONTAINER_IP:443
option tcplog
mode tcp
default_backend apps

backend apps
mode tcp
balance roundrobin
option ssl-hello-chk
server webserver1 CRC_IP:6443 check

frontend api
bind CONTAINER_IP:6443
option tcplog
mode tcp
default_backend api

backend api
mode tcp
balance roundrobin
option ssl-hello-chk
server webserver1 CRC_IP:6443 check
为容器启用转发

$ sysctl net.ipv4.conf.all.forwarding=1
$ sudo iptables -P FORWARD ACCEPT
而且:

注意事项:

  • 当CRC启动时,我有一个警告:
    警告apps-CRC的通配符DNS解析。测试似乎不起作用

  • 即使尝试通过命令行在主机machiche上使用
    oc
    登录,也会失败,并显示一条状态为“禁止”的错误消息:
    服务器错误(内部错误):发生内部错误:意外响应:403

  • 问题在哪里?我想不出来



    对于感兴趣的用户,这是

    此消息表示用户“system:anonymous”没有访问群集的权限。您是否按照文档中的说明登录到crc集群


    这是运行
    crc start

    To access the cluster, first set up your environment by following 'crc oc-env' instructions.
    Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'.
    To login as an admin, run 'oc login -u kubeadmin -p xxxx-xxxx-xxxxx-xxxx https://api.crc.testing:6443'.
    To access the cluster, first set up your environment by following 'crc oc-env' instructions.
    
    因此,您必须先运行,才能在命令行上使用oc客户端:

    crc oc env

    然后,您必须使用oc客户端运行登录。在我的安装中:


    oc登录-u开发者https://api.crc.testing:6443

    当然我也尝试过通过命令行登录!但尝试登录时会显示一条状态相同的错误消息:禁止!我收到了一个关于CORS的建议。这是路吗?我想尝试类似的方法,但我的HAProxy不支持lua负载。有什么建议吗?
    {
      "kind": "Status",
      "apiVersion": "v1",
      "metadata": {
        
      },
      "status": "Failure",
      "message": "forbidden: User \"system:anonymous\" cannot get path \"/\"",
      "reason": "Forbidden",
      "details": {
        
      },
      "code": 403
    }
    
    oc login -u developer https://api.crc.testing:6443
    
    To access the cluster, first set up your environment by following 'crc oc-env' instructions.
    Then you can access it by running 'oc login -u developer -p developer https://api.crc.testing:6443'.
    To login as an admin, run 'oc login -u kubeadmin -p xxxx-xxxx-xxxxx-xxxx https://api.crc.testing:6443'.
    To access the cluster, first set up your environment by following 'crc oc-env' instructions.