You can use the vSphere Automation APIs to customize the HAProxy control plane VM after you install the HAProxy in your vSphere IaaS control plane environment.

If you use the vSphere networking stack in your vSphere IaaS control plane environment, you need to supply your own load balancer. You can use the open source implementation of the HAProxy load balancer that VMware provides.

For more information about the prerequisites for installation and the deployment procedure through the vSphere Client, see the Installing and Configuring vSphere IaaS Control Plane documentation.

You can use the vSphere Automation REST APIs to install and configure the HAProxy load balancer. You can download the latest version of the HAProxy OVA file from the VMware-HAProxy site to a content library item. For more information about how to achieve this task, see Upload an OVF or OVA Package from a Local File System to a Library Item. Then you can create a new VM from the OVA template in the content library as described in Deploy a Virtual Machine or vApp from an OVF Template in a Content Library.

To configure the HAProxy load balancer, use the PUT https://<vcenter_ip_address_or_fqdn>/api/vcenter/namespace-management/clusters/<cluster_id>/load-balancers/<loadbalancer_id> request and submit a LoadBalancers.SetSpec JSON object in the request body. You can define the following HAProxy load balancer settings within the LoadBalancers.HAProxyConfigSetSpec data structure which is an optional property of the LoadBalancers.SetSpec data structure.
Parameter Description
servers A list of Servers that represent the endpoints for configuring the HAProxy load balancers. Each endpoint is described by a load balancer IP address and a Data Plane API management port.

Each endpoint must be described with the port on the HAProxy VM on which the Data Plane API service listens. The Data Plane API service controls the HAProxy server and runs inside the HAProxy VM. The default port is 5556. Port 22 is reserved for SSH.

username The administrator user name that is configured with the HAProxy OVA file and is used to authenticate to the HAProxy Data Plane API server.
password The password for the administrator user name.
certificate_authority_chain The certificate in PEM format that is signed or is a trusted root of the server certificate that the Data Plane API server presents.