cookies - 跨所有 pod 的 Openshift 循环请求

标签 cookies kubernetes openshift sticky-session

我们希望在 openshift 中部署的所有 pod 之间进行循环请求。
我在 Route 配置中配置了以下注释,但对所有 pod 的调用顺序是随机的:

haproxy.router.openshift.io/balance : roundrobin
haproxy.router.openshift.io/disable_cookies: 'true'

我们有 3 个 pods 。我们希望请求有顺序
pods 1、 pods 2、 pods 3、 pods 1、 pods 2、 pods 3、 pods 1....

但是在随机设置上述注释后的真实行为如下:
pod1,pod1,pod2,pod2,pod3,pod1,pod2,pod2.... 这是不正确的。

我们是否需要配置任何 openshift 配置使其成为完美的轮换系统?

最佳答案

如果要依次通过 pod1、pod2、pod3 访问,则应使用 leastconn在同一个 pod 组上。

leastconn   The server with the lowest number of connections receives the
              connection. Round-robin is performed within groups of servers
              of the same load to ensure that all servers will be used. Use
              of this algorithm is recommended where very long sessions are
              expected, such as LDAP, SQL, TSE, etc... but is not very well
              suited for protocols using short sessions such as HTTP. This
              algorithm is dynamic, which means that server weights may be
              adjusted on the fly for slow starts for instance.
roundrobinHAProxy将平均分配请求,但它可能无法保护组中的访问服务器顺序。
roundrobin  Each server is used in turns, according to their weights.
              This is the smoothest and fairest algorithm when the server's
              processing time remains equally distributed. This algorithm
              is dynamic, which means that server weights may be adjusted
              on the fly for slow starts for instance. It is limited by
              design to 4095 active servers per backend. Note that in some
              large farms, when a server becomes up after having been down
              for a very short time, it may sometimes take a few hundreds
              requests for it to be re-integrated into the farm and start
              receiving traffic. This is normal, though very rare. It is
              indicated here in case you would have the chance to observe
              it, so that you don't worry.

引用 HAProxy balance (algorithm)有关平衡算法选项的详细信息。

关于cookies - 跨所有 pod 的 Openshift 循环请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55549489/

相关文章:

javascript - 如何创建 Cookie 来记住 Javascript 指令

javascript - 不断更新cookie导致浏览器崩溃

raspberry-pi - kubernetes pod 卡在容器创建中

openshift - 单个 openshift 应用程序可以有多个域吗?

wordpress - 在哪里保存 openshift wordpress 安装的插件

java - EAP 6.3 基本 hibernate 更新抛出异常

c# - 使用 CookieContainer 的 WCF Web 服务客户端

cookies - JWT + cookies + HTTPS + CSRF

python - 从 Python 在 kubernetes 集群上提交 Spark (2.3)

kubernetes - Kubernetes 内部的 Istio CORS 和 SSL 问题