why is this annotation of ewma are different?

2.1k Views Asked by At

I have one service with 10 pods inside of my cluster and it sends multiple requests to the master node for more than an hour. I put an annotation in my ingress resource and modified it with some annotation, the first annotation I used is only to change the load balancer method to ewma load balancing.

Annotations:       nginx.ingress.kubernetes.io/load-balance: ewma

During the time when the client requested the service from the master node, it received the request perfectly, which means the client received different responses from different pods and from different agent nodes inside of the cluster.

but when I changed the annotation to this annotation

nginx.ingress.kubernetes.io/upstream-hash-by: "ewma"

the client received the same answer every time from the same pod and from the same node, even I send requests for the service 5 times in a second for more than 30 minutes. are they implemented correctly? and why are they different?

1

There are 1 best solutions below

1
On BEST ANSWER

This is a community wiki answer posted for better visibility. Feel free to expand it.

Root cause:

The nodes should receive equal requests from clients (load balancing) and at the same time saving machine resources.

Due to this, need to find the best solution between annotations below (based on the question):

nginx.ingress.kubernetes.io/load-balance: ewma

and

nginx.ingress.kubernetes.io/upstream-hash-by: ewma

Solution:

Usage of nginx.ingress.kubernetes.io/load-balance: ewma annotation is preferable solution for the mentioned purpose.

Based on the documents: load-balance use the Peak EWMA method for routing. In contrast, of upstream-hash-by, which is load balance using consistent hashing of IP or other variables and provides connection to the same pod.

For more information, see this article Kubernetes Nginx Ingress: Consistent hash subset load balancer.