This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.21.4. 配置外部负载均衡器
您可以在 Red Hat OpenStack Platform(RHOSP)上配置 OpenShift Container Platform 集群,使其使用外部负载均衡器来代替默认负载均衡器。
先决条件
- 在您的负载均衡器中,系统中的所有用户需要使用端口 6443、443 和 80 的 TCP。
- 在每个 control plane 节点间负载均衡 API 端口 6443。
- 在所有计算节点之间负载平衡应用程序端口 443 和 80。
- 在负载均衡器中,用于为节点提供 ignition 启动配置的端口 22623 不会在集群外公开。
您的负载均衡器必须能够访问集群中的每台机器。允许此访问的方法包括:
- 将负载均衡器附加到集群的机器子网。
- 将浮动 IP 地址附加到使用负载均衡器的机器。
流程
在端口 6443、443 和 80 中启用从负载均衡器访问集群的功能。
例如,请注意此 HAProxy 配置:
HAProxy 配置示例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在集群 API 的 DNS 服务器中添加记录,并在负载均衡器上应用记录。例如:
<load_balancer_ip_address> api.<cluster_name>.<base_domain> <load_balancer_ip_address> apps.<cluster_name>.<base_domain>
<load_balancer_ip_address> api.<cluster_name>.<base_domain> <load_balancer_ip_address> apps.<cluster_name>.<base_domain>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在命令行中使用
curl
验证外部负载均衡器和 DNS 配置是否正常运行。验证集群 API 是否可以访问:
curl https://<loadbalancer_ip_address>:6443/version --insecure
$ curl https://<loadbalancer_ip_address>:6443/version --insecure
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 如果配置正确,您会收到 JSON 对象的响应:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 验证集群应用程序是否可以访问:
注意您还可以在 Web 浏览器中打开 OpenShift Container Platform 控制台来验证应用程序的可访问性。
curl http://console-openshift-console.apps.<cluster_name>.<base_domain> -I -L --insecure
$ curl http://console-openshift-console.apps.<cluster_name>.<base_domain> -I -L --insecure
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 如果配置正确,您会收到 HTTP 响应:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow