1
votes

I have a service using Azure Kubernetes cluster and AKS load balancer. I want to forward some HTTP(client) requests to all instances. is there any way to configure this behavior using AKS or Kubernetes in general?

Say I have XYZ API running two replicas/instances.

  • XYZ-1 pod instance
  • XYZ-2 pod instance

I have some rest API requests to the app domain.com/testendpoint

Currently, using AKS load balancer it sends the requests in a round-robin fashion to XYZ-1 and XYZ-2. I am looking to see if it is possible to forward a request to both instances (XYZ-1 and XYZ-2) when the request endpoint is testendpoint and all other API requests use the same round-robin order.

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.

1
What do you mean? Isn't this what a "load blancer" does? What do you mean with "to all instances" - that it should broadcast your request or use round robin to distribute load to the instances? "all instances" - you mean all replicas of an app, or to all different pods - for different apps - why would you like that?Jonas
There are some requests that I want to forward to all pod instances. I updated my question now.vkt
How do you plan do handle the responses? If the client receives both responses - its an error - must not happen.Jonas
What's the purpose of the call? Should there be a return value? If it is to do some work on all instances try a messaging service like event grid and have all instances listen to an event.Peter Bons
This is to refresh in-memory data via a call once a day or twice and the call will be triggered by another service when needed. so want to make sure all pod instances update/refresh in memory data by HTTP request.vkt

1 Answers

2
votes

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

This is not a feature in the HTTP protocol, so you need a purpose built service to handle this.

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.

I suggest that you create a new utility service, "update-service" - that you send the call once a day to. This service then makes a request to every instance of XYZ, like XYZ-1 and XYZ-2.