openshift_cluster_hostname 的流量如何重定向到 openshift web 控制台

how is the traffic to the openshift_cluster_hostname is redirected to the openshift web console

问题 1:

1.1。谁坐在“openshift_master_cluster_public_hostname”主机名后面?是 Web 控制台(Web 控制台服务?还是 Web 服务部署)还是其他?

1.2。在执行 oc get service -n openshift-web-console 时,我可以看到 Web 控制台在 443 中运行,它不应该在端口 8443 上工作吗,同样的事情 api 服务器,不应该在端口 8443 上工作吗?

1.3。你能给我解释一下请求到 https://openshift_master_cluster_public_hostname:8443 的流程吗?

1.4。在文档中是

问题二:

为什么我对 curl 和 wget 的响应不同?
当我:curl https://openshift_master_cluster_public_hostname:8443 时,我得到:

{
  "paths": [
    "/api",
    "/api/v1",
    "/apis",
    "/apis/",
    "/apis/admissionregistration.k8s.io",
    "/apis/admissionregistration.k8s.io/v1beta1",
    "/apis/apiextensions.k8s.io",
    "/apis/apiextensions.k8s.io/v1beta1",
    ...
    "/swagger.json",
    "/swaggerapi",
    "/version",
    "/version/openshift"
  ]
}

当我 : wget https://openshift_master_cluster_public_hostname:8443 我得到一个 index.html 页面。

网络控制台是在回答这个请求还是

问题 3 :

我怎样才能在端口 443 而不是 8443 上公开 Web 控制台,我找到了几个解决方案:

  1. 使用变量“openshift_master_console_port,openshift_master_api_port”但发现这些端口是“内部”端口而不是设计为 public 端口。因此,更改此端口可能会使您的 OpenShift 设置崩溃

  2. 使用外部服务(描述 here

我正在尝试在外部 haporxy 上设置端口转发,是否可行?

问题 1 的答案:

1.1。引用文档 Configuring Your Inventory File

This variable overrides the public host name for the cluster, 
which defaults to the host name of the master. If you use an 
external load balancer, specify the address of the external load balancer.

For example:

> openshift_master_cluster_public_hostname=openshift-ansible.public.example.com

这意味着该变量是 Public 面向 OpenShift Web 控制台的接口。

1.2 服务是一个虚拟对象,它将服务名称连接到pods,用于连接路由对象和服务对象。这在文档 Services 中有解释。您几乎可以将每个端口用于一个服务,因为它是虚拟的,没有任何东西会绑定到这个端口上。

1.3。答案取决于您的设置。我在大师面前用 TCP 负载均衡器在 ha-setup 中解释它。

                       /> Master API 1
client -> loadbalancer -> Master API 2
                       \> Master API 3

Client 向 https://openshift_master_cluster_public_hostname:8443 发送请求,负载均衡器将 Client 转发给 Master API 1 or 2 or 3并且客户端从请求的主服务器API服务器获得答案。

api 如果请求来自浏览器,服务器重定向到控制台 ( https://github.com/openshift/origin/blob/release-3.11/pkg/cmd/openshift-kube-apiserver/openshiftkubeapiserver/patch_handlerchain.go#L60-L61 )

问题 2 的答案:

curlwget 行为不同,因为它们是不同的工具,但 https 请求是相同的。

wget 的卷曲行为
wget --output-document=- https://openshift_master_cluster_public_hostname:8443

curl 的 wget 行为
curl -o index.html https://openshift_master_cluster_public_hostname:8443

为什么在Usage of dash (-) in place of a filename

中描述了-

问题 3 的答案:

您可以使用用于应用程序的 OpenShift Router 使 Web 控制台在 443 上可用。它有点过时但概念与当前 3.x 版本相同 Make OpenShift console available on port 443 (https) [UPDATE]