I have 3 replicas for my pod whenever there is a traffic received the service might select any of the pod to redirect the request (round robin) instead of randomly selecting the pod I want to re redirect the traffic to that pod whose cpu and memory utilization is less than when compared to other 2 pods. how to implement this in kubernetes?
Kubernetes does not do this out of the box. The explanation can get lengthy, but it boils down to the idea that kube services don’t have a “middle box”, so you have every node making decisions independent of and async to every other node. That’s a whole lot of randomness injected into the balancing, anyway.
TL;DR kube doesn’t do this. Might need a higher order service mesh if you really want this, and it may still look random in the end.