When I create a service of type LoadBalancer, it is supposed to register the k8s cluster somehow with a cloud provider’s loadbalancer. I don’t quite understand how it works (how the registration is implemented internally), but my question is related.
How can I make a LoadBalancer service register itself with some private load balancer (not one belonging to the big cloud operators but my own on-premise one)? I see several variants as an example:
- k8s registers the IP addresses of its pods in a DNS zone
- k8s registers a service in Consul
- k8s generates a haproxy.cfg
Can you please point me in the right direction? Maybe my whole direction of thought is wrong?
Of course I can always use a NodePort type of service and manually list the IP addresses and ports of all pods in haproxy.cfg, but I will lose automation when pods are created and terminated.