当在 OpenShift 上运行以及由 Red Hat build of Keycloak Operator 提供的默认 passthrough Ingress 设置时,HAProxy 所做的负载均衡会根据源的 IP 地址使用粘性会话来实现。在运行负载测试时,或者在 HAProxy 前面运行反向代理时,您可能需要禁用此设置以避免在单个红帽构建的 Keycloak Pod 上接收所有请求。
在红帽构建的 Keycloak 自定义资源的 spec 下添加以下补充配置,以禁用粘性会话。
spec:
ingress:
enabled: true
annotations:
# When running load tests, disable sticky sessions on the OpenShift HAProxy router
# to avoid receiving all requests on a single Red Hat build of Keycloak Pod.
haproxy.router.openshift.io/balance: roundrobin
haproxy.router.openshift.io/disable_cookies: 'true'
spec:ingress:enabled:trueannotations:# When running load tests, disable sticky sessions on the OpenShift HAProxy router# to avoid receiving all requests on a single Red Hat build of Keycloak Pod.haproxy.router.openshift.io/balance: roundrobin
haproxy.router.openshift.io/disable_cookies:'true'
Copy to ClipboardCopied!Toggle word wrapToggle overflow