简体   繁体   中英

Round-Robin for connection-based load-balancing

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"

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM