How to set up a F5 Load Balancer for HA

Issue

  • How to set up a F5 Load Balancer for CJOC and CM HA

Environment

  • Cloudbees Jenkins Operations Center
  • Client Master
  • F5 Load Balancer

Resolution

  • The F5 Load Balancer needs to be configured to load balance HTTP(S) traffic to the CloudBees Jenkins Instances which form the HA singleton.
  • The F5 Load Balancer needs to performance a health check on the Jenkins Instances on /ha/health-check

Route HTTP(S) Traffic

Configure the “frontend” of the F5 Load Balancer to route incoming HTTP(S) requests to the two CloudBees Jenkins Instances “alpha” and “beta” in the “backend”.

The combination of Hostname / VIP / Port must be unique for each of the cluster: that is, if the port is fixed (443 usually if using HTTPS) the VIP can be shared in the different clusters if the hostnames are different. The VIP is used to select the correct “backend” based on the Host header.

You can run the following script from Manage Jenkins->Script Console to check if headers are set properly:

   println Jenkins.instance.rootUrlFromRequest
   println org.kohsuke.stapler.Stapler.currentRequest.getHeader('X-Forwarded-For')
   println org.kohsuke.stapler.Stapler.currentRequest.getHeader('X-Forwarded-Host')
   println org.kohsuke.stapler.Stapler.currentRequest.getHeader('X-Forwarded-Proto')
   println org.kohsuke.stapler.Stapler.currentRequest.getHeader('X-Forwarded-Port')
   println org.kohsuke.stapler.Stapler.currentRequest.serverPort
   println org.kohsuke.stapler.Stapler.currentRequest.serverName

Perform Health Check

Configure the load balancer to perform a health check by issuing a HEAD HTTP request on the nodes on /ha/health-check.

OneConnection

If you are using a feature called OneConnection or something similar to improve the networking performance, please deactivate it for this environment as we have the experience it makes the connection to break.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.