Dynamic Add Service to Load Balanacer

(Side note, those are probably not the best header and code… Anyway)

Add a balancer with a portRule for each source port that has a selector like balance=me. Then you add the same label to some service(s), and the service has a field for lbConfig where you can add more portRules that will target this service. If this works for your use case it’s actually much nicer than updating the balancer separately because the rules live and die with the service automatically.

http://docs.rancher.com/rancher/v1.2/en/api/v2-beta/api-resources/service/

3 Likes