Automatically scale the Infoblox Grid in your VMWare environment
Autoscaling is a method whereby the amount of computational resources in an environment, scales automatically based on the load. With the growing dynamism in user environments and need for automation, autoscaling helps in adapting to the environment easily.
The script here enables you to automatically scale up or down the Infoblox grid,hosted on a VMWare environment, based on DNS queries per second.
What does the script do?
The powershell script polls the DNS queries being served per second, using SNMP. Based on thresholds that are set by the user, it scales up or down by adding or deleting one grid member at a time.
What modules does the script use?
The script is written in Powershell. It uses the SNMP module in order to fetch the DNS QPS information. Please note that SNMP should have been pre-configured on the Infoblox grid. It uses VMWare PowerCLI for VM related operations, and the ovftool to deploy a grid member with all the initial configuration. It also uses Infoblox REST APIs to do all the necessary configurations in the Grid.
Before you get started
Ensure you have the following components in your environment:
- Windows Powershell
- Powershell SNMP module
- VMWare PowerCLI module for Powershell
- ovftool (4.3.0)
- Connectivity to both, the vCenter Server and Infoblox Grid
Ensure the following configurations are enabled on the Infoblox grid
- SNMP configuration
- A reserved range defined within a subnet, from which IP addresses can be automatically assigned to the scaled-up members
Ensure that you modify the variables above which the comment "NEEDS TO BE MODIFIED WITH VALUES SPECIFIC TO YOUR ENVIRONMENT" is added, such as:
- $vmfolder: Location in the vCenter Server where the new Virtual Machine needs to be created
- $datastore: The datastore the VM will reside on. You can run Get-Datastore command to get a list of all the datastores in your environment
- $dportgroup: The Distributed port group that the VM will be connected to. You can run Get-VDPortgroup to get a list of all the distirbuted port groups in your environment
- $range: The range within which the next available IP address can be found to assign to a new member
- $memberip: The gateway and subnet mask need to be changed
- $gridjoindetails: This is the details of the existing grid that the new member needs to join
- $nsname: The nameserver group that the new member will be added to.
How does the autoscaling work?
Consider an existing grid hosted on a vCenter Server that is responding to DNS queries. This script constantly polls for the DNS QPS and compares it with the threshold that has been set. Once the threshold is reached, a new member is created and attached to the grid.
It first creates and initializes a member on vCenter, then adds the member to the grid, adds a fixed address entry on the grid, enables the DNS and DHCP services, and adds the newly joined member to the nameserver group so it can start answering to the DNS queries.
It continues to poll the DNS QPS and when the fall below a specified threshold, it deletes the newly spun up member.
First, it removes the member from the nameserver group, removes the member from the grid, deletes the fixed address entry, and finally shuts down and deletes the Virtual Machine.
If there are no scaled-up members available for deleting, it continues to poll the DNS QPS. It does not alter the Grid environment you began with.
Demo and Deployment Guide
For a quick demo, you can refer to this video.
For deploying it in your environment, you can refer this document.
This script scales your environment up or down automatically without any need for human intervention.