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

Azure Kubernetes LoadBalancer forward requests to all instances

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

假设我有 XYZ API 运行 两个 replicas/instances.

我对应用域有一些休息 API 请求。com/testendpoint

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

每天一次或两次通过休息调用刷新服务内存数据的用例,休息调用将在需要时由另一个服务触发。所以想通过 HTTP 请求确保所有 pod 实例 update/refresh 内存中的数据。

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

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

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.