Custom Kubernetes request routing and load balancing

Hello everyone!

I am currently exploring the use of Kubernetes (K3S) in an edge environment. Given that hops to another worker node in an edge environment can bring along additional delays, I would like to adjust request routing and load balancing in such a way that requests are preferably sent to a pod which is on the same node and only if the same node is overloaded send it to another worker node. I’ve explored LoadBalancer services, Ingress, other types of Services but nothing seems to provide this type of customization.

One of the soulutions that I found is adjusting the code of kube-proxy itself to adjust routing in such a way. Shown in the following image.

This image is taken from Sensors | Free Full-Text | Load-Balancing of Kubernetes-Based Edge Computing Infrastructure Using Resource Adaptive Proxy. It depicts what load balancing scenario I would like to achieve. RAP is a modified kube-proxy.

If this is the only way, what would be the way to adjust the kube-proxy code itself and run it?
If there are other ways to achieve this, what are they?

Thanks in advance. :slight_smile:

Kube-proxy does not have a built-in dynamic load-feedback mechanism, today, unfortunately.