最近,我尝试在VMWare上安装openshift 4.2,并遵循此文档https://blog.openshift.com/openshift-4-2-vsphere-install-with-static-ips/,因此我能够成功安装它,并且可以正常工作。但是此安装对所有内容使用单个LoadBalancer(HAProxy)。
因此,在我的情况下,LoadBalancer的IP为10.68.33.62,然后按如下所示映射了URL
10.68.33.62 api.openshift4.example.com
10.68.33.62 api-int.openshift4.example.com
10.68.33.62 *.apps.openshift4.example.com
这意味着所有URL都在一个LoadBalancer中。我可以从下面的URL访问控制台
https://console-openshift-console.apps.openshift4.example.com
甚至其他应用也可以从https://anotherapp.apps.openshift4.example.com访问
HA代理配置文件
frontend openshift-api-server
bind *:6443
default_backend openshift-api-server
mode tcp
option tcplog
backend openshift-api-server
balance source
mode tcp
server bootstrap 10.68.33.66:6443 check
server master1 10.68.33.63:6443 check
server master2 10.68.33.67:6443 check
server master3 10.68.33.68:6443 check
frontend machine-config-server68
bind *:22623
default_backend machine-config-server
mode tcp
option tcplog
backend machine-config-server
balance source
mode tcp
server bootstrap 10.68.33.66:22623 check
server master1 10.68.33.63:22623 check
server master2 10.68.33.67:22623 check
server master3 10.68.33.68:22623 check
frontend ingress-http
bind *:80
default_backend ingress-http
mode tcp
option tcplog
backend ingress-http
balance source
mode tcp
server worker1 10.68.33.64:80 check
server worker2 10.68.33.65:80 check
frontend ingress-https
bind *:443
default_backend ingress-https
mode tcp
option tcplog
backend ingress-https
balance source
mode tcp
server worker1 10.68.33.64:443 check
server worker2 10.68.33.65:443 check
但是在阅读了文档https://docs.openshift.com/container-platform/4.2/installing/installing_vsphere/installing-vsphere.html#installation-network-user-infra_installing-vsphere之后,我决定使用两个负载平衡器。该API需要一个负载平衡器,默认的Ingress Controller需要第二个负载平衡器以向应用程序提供入口。
现在,在这种情况下,我如下所示映射了URL
10.68.33.62 api.openshift4.example.com
10.68.33.62 api-int.openshift4.example.com
并且假设第二个负载平衡器的IP为10.68.33.69
10.68.33.69 *.apps.openshift4.example.com
并且第一个负载平衡器的HAProxy配置仅平衡主节点。
frontend openshift-api-server
bind *:6443
default_backend openshift-api-server
mode tcp
option tcplog
backend openshift-api-server
balance source
mode tcp
server bootstrap 10.68.33.66:6443 check
server master1 10.68.33.63:6443 check
server master2 10.68.33.67:6443 check
server master3 10.68.33.68:6443 check
frontend machine-config-server68
bind *:22623
default_backend machine-config-server
mode tcp
option tcplog
backend machine-config-server
balance source
mode tcp
server bootstrap 10.68.33.66:22623 check
server master1 10.68.33.63:22623 check
server master2 10.68.33.67:22623 check
server master3 10.68.33.68:22623 check
并且第二个负载平衡器仅平衡工作节点,因为它将仅服务于应用程序。
frontend ingress-http
bind *:80
default_backend ingress-http
mode tcp
option tcplog
backend ingress-http
balance source
mode tcp
server worker1 10.68.33.64:80 check
server worker2 10.68.33.65:80 check
frontend ingress-https
bind *:443
default_backend ingress-https
mode tcp
option tcplog
backend ingress-https
balance source
mode tcp
server worker1 10.68.33.64:443 check
server worker2 10.68.33.65:443 check
但是很遗憾,它没有用。我的理解正确吗?简而言之,我想通过第一个负载平衡器平衡主控制台和API,并通过第二个负载平衡器平衡应用程序。我将如何实现?
谢谢
只需更新。我在安装程序上使用此确切的配置,它可以正常工作。