gpt4 book ai didi

Azure Kubernetes LoadBalancer 将请求转发到所有实例

转载 作者:行者123 更新时间:2023-12-03 01:27:15 27 4
gpt4 key购买 nike

我有一项使用 Azure Kubernetes 群集和 AKS 负载均衡器的服务。我想将一些 HTTP(客户端)请求转发到所有实例。一般来说,有什么方法可以使用 AKS 或 Kubernetes 配置此行为吗?

假设我有 XYZ API 运行两个副本/实例。

  • XYZ-1 Pod 实例
  • XYZ-2 Pod 实例

我有一些对应用程序domain.com/testendpoint 的其余API 请求

目前,使用 AKS 负载均衡器以循环方式将请求发送到 XYZ-1 和 XYZ-2。我想看看当请求端点为 testendpoint 并且所有其他 API 请求使用相同的循环顺序时,是否可以将请求转发到两个实例(XYZ-1 和 XYZ-2) .

通过每天一次或两次的休息调用刷新服务内存数据的用例,并且休息调用将在需要时由另一个服务触发。因此希望确保所有 pod 实例都通过 HTTP 请求更新/刷新内存中的数据。

最佳答案

if it is possible to forward a request to both instances (XYZ-1 and XYZ-2) when the request endpoint is testendpoint

这不是 HTTP 协议(protocol)中的功能,因此您需要专门构建的服务来处理此问题。

The use case to refresh a service in-memory data via a rest call once a day or twice and the rest call will be triggered by another service when needed. so want to make sure all pod instances update/refresh in-memory data by an HTTP request.

我建议您创建一个新的实用服务“更新服务” - 您每天向其发送一次调用。然后,该服务向 XYZ 的每个实例发出请求,例如 XYZ-1XYZ-2

关于Azure Kubernetes LoadBalancer 将请求转发到所有实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65080754/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com