3 minute read

Setting up a Virtual Service in a Load Balancer is normally a simple task:

  • We setup a server pool with the servers running the application to be load balanced
  • We setup a virtual service, and associate a VIP, to make the load balanced application available

Simple Example

  • Load Balancing an NTP service
    • Create Virtual Service - ntp_lb
    • Create Server Pool with our two (2) internal ntp servers - ntp_lb_internal_pool

    Load Balance NTP

What if

What if … we want to give our Virtual Service the ability to use a backup pool in case of the primary server pool fails?

Solution

One way of implementing this in Avi/NSX ALB you can use the pool groups functionality.

As an example we will setup a NTP Load Balancer service that will use an internal pool as the primary pool and will fallback to public NTP servers in case no internal NTP server is available.

Pool Groups

Quickly explained a pool group in Avi/NSX ALB is a pool where the members of the pool are another pools.

The idea will be to setup multiple server pools to define different groups of NTP servers and then assign different priorities that will be used in case of the members of an higher priority pool becomes unavailable.

Load Balance - Full Setup

Creating Pools for Pool Groups

We setup two (2) pools:

  • ntp-lb-internal-pool - in this pool will use our internal NTP servers as members
  • ntp-lb-public-pool - in this pool we will configure a couple of public NTP servers as members

This is a simple configuration we create two (2) pools, in our example we setup an internal pool with two (2) members and public pool with sixteen (16) members.

Pools

Creating Pool Group

We will add the two (2) pools with different priorities.

  • Pools
    • NTP internal pool - will have a priority of 100 Internal Pool

    • NTP public pool - will have a priority of 50 Public Pool

  • Pool Group
    • The higher priority pools will be used, and ratios can be applied across pools with the same priority to distribute the load between the pools
    • If an higher priority pool becomes unavailable the pools in the next priority will be used, in our example, if all the members of the NTP internal pool become unavailable then the NTP public pool will be the made available
    • Pool group member configuration Internal Pool - Pool Group Member Configuration Public Pool - Pool Group Configuration
    • Pool group configuration Pool Group Configuration

Now we should test it

Now that we have all the configuration, we should test it.

Pool Group - Final config

All pools available

All pools available

Test a NTP query to our Virtual Service

  • Test with ntpdate Test - _ntpdate_ test
  • Virtual Service logs Test - VS log

Fail primary pool

Fail _primary pool_

Test a NTP query to our Virtual Service

  • Test with ntpdate Test - _ntpdate_ test
  • Virtual Service logs Test - VS log

All Pools fail

  • All pools down All _pools_ failed
  • With all pools down the Virtual Service will also be marked as down _VS_ down_

Test a NTP query to our Virtual Service

  • Test with ntpdate Test - _ntpdate_ test
  • Virtual Service logs Test - VS log

Conclusion

It seems that we were able to setup what we were aiming for, a Virtual Service that has a backup pool in case of a failure of our main pool.

References