How to change ROUTER_LOAD_BALANCE_ALGORITHM in OpenShift Container Platform 4?

Solution Verified - Updated -

Environment

  • Openshift Container Platform (OCP)
    • 4.x

Issue

  • How to change ROUTER_LOAD_BALANCE_ALGORITHM router level settings in OpenShift Container Platform 4?

Resolution

  • ROUTER_TCP_BALANCE_SCHEME for passthrough routes, the default value is source for TLS passthrough routes. Otherwise, use ROUTER_LOAD_BALANCE_ALGORITHM, the default is random for all other routes.
    Since Red Hat OpenShift Container Platform 4.8, the Power of Two Random Choices balancing algorithm has been enabled by default(except passthrough is source) to achieve equal distribution of requests toward the backend pods for more even balancing after reloading.

  • The RFE-1899 has been filled to introduce a configurable parameter to bring in the functionality in the OCP 4. Currently the feature in the router level is not configurable for OCP 4. Instead, the balancing algorithm for a specific route can still be configured using haproxy.router.openshift.io/balance Route-specific annotations can override the defaults value(random) by providing specific available configurations random, source, roundrobin, leastconn in the route annotations.

# oc annotate --overwrite route/example-route haproxy.router.openshift.io/balance=roundrobin

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments