Below are a few examples of configuring load balancers to meet the needs of a HA configuration. The examples assume SSL bridging will be used, which means an SSL (TLS) certificate is presented by the load balancer to clients and the load balancer will communicate with the backend nodes via a different (possibly same) certificate.
This configuration is recommended because the Morpheus application nodes will create self-signed certificates and the load balancer will present a valid certificate to end users. Additionally, all communication will be encrypted.
This reduces the overhead of maintaining the certificates on the Morpheus application nodes, as the load balancer can ignore invaild certs on the application nodes.
However, the certificates on the Morpheus application nodes are not required to be self-signed, they can be replaced with other trusted certificates following the SSL Certificates documentation.
Tip
The list below is not meant to be a complete list for all load balancers. The provided examples are common deployments that can be used for reference. The settings mentioned in the examples list the primary settings that may need to be configured, other settings are based on the organization’s needs requirements and own configuration.
Example /etc/haproxy/haproxy.cfg
configuration file
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# https://www.haproxy.org/download/1.8/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log 127.0.0.1:514 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
# utilize system-wide crypto-policies
ssl-default-bind-ciphers PROFILE=SYSTEM
ssl-default-server-ciphers PROFILE=SYSTEM
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
frontend main
mode http
bind *:443 ssl crt /etc/haproxy/ssl/combined_crt_key.pem
default_backend mybackend
backend mybackend
mode http
option httpchk
http-check send meth GET uri /ping
http-check expect string MORPHEUS\ PING
balance leastconn
server app1 192.168.101.1:443 check ssl verify none
server app2 192.168.101.2:443 check ssl verify none
server app3 192.168.101.3:443 check ssl verify none
In this example, it is assumed End-To-End TLS Encryption is being used, which means the Application Gateway will present a certificate
to the clients and the backend nodes will present the same certificate.
If a setting is not mentioned, it is assumed that the default can be maintained.
General Settings
Frontend Configuration
Type: Set Public if Morpheus should be accessilbe externally, otherwise choose Private
Public IP Address: Associate a previously create public IP or create a new one
Listener
Backend Settings
Backend protocol: HTTPS
Backend port: 443
Use well known CA certificate:
If set to Yes, the certificate does not need to be uploaded in the settings. This must be a well known certificate provided by a
well known certificate authority, not an internally generated certificate
If set to No, ensure the certificate that is present on the backend nodes is uploaded to the Application Gateway.
Note that the certificate should include the entire chain (CA, Intermediates, Certificate)
Cookie-based affinity: Disable
Connection draining: Enable
Override with new host name: No
Use Custom probe: No (one will be created next and will be assoicated during that configuration)
Health Probe
Protocol: HTTPS
Host: Enter the host that is configured on the Morpheus application nodes. This same host that will be used on the Application Gateway
Example: morpheus.mydomain.com
Pick host name from backend settings: No
Pick port from backend settings: Yes
Path: /ping
Use probe matching conditions: Yes
HTTP response status code match: 200-399
Backend settings: Choose the backend settings created above
Backend Pool
Important Items
Ensure the backend virtual machines allow port 443 from the load balancer, otherwise a 502 error may be seen
If using a wildcard certificate, you must use a custom health probe, as mentioned above, otherwise you may see the following error message:
As mentioned above, ensure the complete chain for the certificate is presented by Morpheus, otherwise you may see the following error message:
Configuring the certificate on the Morpheus nodes
Additional reading: