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.
All such controllers are async to the API. In general a cluster has 1 LB provider (but that assumption is changing). The provider controller watches Services and creates LBs in response. If you are not already using a provider, like a cloud, you can run one or write your own. How it works is up to you! Nodeports are an option, but not required.
Oh sorry. I was just curious if you already had access to a load balancing appliance (like an F5 or Citrix that you could potentially take advantage of instead of building new.
I already have a Consul cluster. I thought if I could make k8s register its services in the Consul cluster (thus making the IPs and ports available via DNS SRV records) this would be sufficient for me.