Avi/NSX ALB - Setting up a Virtual Service with Backup Pools
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
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.
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.
Creating Pool Group
We will add the two (2) pools with different priorities.
- Pools
- 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
- Pool group configuration
Now we should test it
Now that we have all the configuration, we should test it.
All pools available
Test a NTP query to our Virtual Service
Fail primary pool
Test a NTP query to our Virtual Service
All Pools fail
Test a NTP query to our Virtual Service
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.