I am running 4 replicas of the bf-v instance. I am using ClientIP as a sessionAffinity.
I want to distribute requests based on the client IP address, but also distribute client IPs evenly (round-robin based) across replicas. I want pods to have the same number of clients. is there any way to achieve this kind of distribution? (the default round-robin gets affected by session affinity)
Thanks :)
svc.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: bf-v
name: bf-v
spec:
ports:
- port: 80
type: LoadBalancer
selector:
app: bf-v
sessionAffinity: "ClientIP"
CodePudding user response:
Two options:
1- Use IPVS mode with ipvs-scheduler=sh (sh -> source hashing)
2- Use ClientIP affinity in your svc.yaml with ipvs-scheduler=rr (rr -> round robin)