I want to implement a simple Layer 7 Load Balancer in my kubernetes cluster which will allow me to expose kubernetes services to external consumers.
I will create a simple ha-proxy based container which will observe kubernetes services and respective endpoints and reload its backend/frontend configuration (complemented with SYN eating rule during reload)
This will allow me to access kubernetes services like SVCa, SVCb, SVCc over
http://load-balancer-ip:port/SVCa -------> Pod endpoints.....
http://load-balancer-ip:port/SVCb -------> Pod endpoints.....
http://load-balancer-ip:port/SVCc -------> Pod endpoints.....
How would above approach work compared to
(1) ha-proxy forwarding all the requests to clusterIP address of kubernetes services.
http://load-balancer-ip:port/SVCa ------->clusterIP-SVCa
http://load-balancer-ip:port/SVCb ------->clusterIP-SVCa
http://load-balancer-ip:port/SVCc ------->clusterIP-SVCa
(2) ha-proxy load-balancing requests to worker-node-ip:port obtained by creating NodePort type services
http://load-balancer-ip:port/SVCa --------> node1:p1, node2:p1, node3:p1
http://load-balancer-ip:port/SVCb --------> node1:p2, node2:p2, node3:p2
http://load-balancer-ip:port/SVCc --------> node1:p3, node2:p3, node3:p3
Note: My k8s cluster is running on custom solution (on-premise VMs)