Many networking enhancements have been made available with the release of vCloud Director 5.1 using vCNS 5.1 (vCloud Networking and Security) and vSphere 5.1. There have been inquiries and activity around some of the new features and how to configure them; load balancing being one of them. If you have more than one VM as part of a pool and want incoming traffic to be balanced between them, this is a key feature included with your product.
Today, I’m going to walk you through one way to configure Load Balancer services on an Edge Gateway in vCloud Director. Many of the vCNS concepts and features are explained in Ranga’s post here, Load Balancing with vCNS, but I’m going to point out a few key points to pay attention to. This article takes you straight into the vCloud Director web portal in order to configure everything as a vCloud Director Administrator.
To see how this can be configured in your cloud environment, continue reading…
Take note that not every screen shot for the entire configuration is presented in this article. I tried to keep it short and clean with only critical screens shown.
First, ensure you have your cloud configured with an external network. Shown here, I have an external network with an IP pool of 192.168.66.20-39:
Create an Edge Gateway assigned to your Organization vDC that maps this External Network to an Organization Network.
Finally, create an Organization vDC Network and map it to the Edge Gateway. As shown here, I have created a routed network with an internal-facing pool of IP addresses ranging from 192.168.77.50-100:
I created a vApp with two server virtual machines and attached them to this Org vDC Network. The first server has an IP of 192.168.77.50 and the second server has an IP of 192.168.77.51. Take note of the assigned IP addresses as later you’ll see how these IP addresses are used in the load balancer services configuration.
Next, right-click on the Edge Gateway and click “Properties” to sub-allocate an IP pool on the Edge Gateway. These IP addresses can be used as load balancer IPs for your Load Balancer services later on; this range of IP addresses is a sub-allocation of the external network’s IP pool created earlier (this sub pool uses the IP range of 192.168.66.35-39 from the 192.168.66.20-39 pool above):
From here, after clicking “Ok,” right-click the Edge Gateway again and select “Edge Gateway Services…”
Select the Load Balancing tab and add a pool of servers. Input a name and description, then configure the services. When selecting the “Balancing Method,” keep the following information in mind:
IP_HASH: Selects a server based on a hash of the source IP address of each packet.
LEAST_CONN: New connections are sent to the server with the fewest connections.
ROUND_ROBIN: Each server is used in turn according to the weight assigned to it.
URI: The left part of the URI (before the question mark) is hashed and divided by the total weight of the running servers. The result designates which server will receive the request. Applicable to only HTTP service load balancing.
Select the services and enter the appropriate port(s) you wish to load balance. Configure the monitoring service ports under the “Health Check” configuration page. Select the proper Health Check Modes and Parameters.
Next, add back-end server members to this pool. As noted above, enter the IP address(es) for the member servers in your vApp(s). Keep in mind the Ratio Weight will specify how requests are proportionately routed to members in comparison to other member weights in the pool:
Review your work and click “Finish” when complete:
Following the Pool Servers creation, now a Virtual Server needs to be created and assigned. Select the “Virtual Servers” button and click Add. Enter a name for the virtual server (this will need to match what you enter into DNS for this IP address, too, if you want to reach it by name) and select the network (the external network we referenced earlier). The IP Address is manually entered, but needs to be a part of the sub-allocated IP pool we created earlier. In this example, 192.168.66.35 is selected:
Configure the Port, Persistence Method, Cookie Name, and Cookie Mode values as required. Enable the Virtual Server and click Ok. Please note that your pool server will show a status of down if there are no member servers available to receive traffic on the ports selected.
Finally, create firewall rules on this Edge Gateway in order to allow the desired traffic through the firewall. Select the Firewall tab under the “Edge Gateway Services…” menu item if you aren’t still on this screen. “Add…” a rule for each of the services you wish to allow through the firewall. In this example, a rule is being configured for the HTTP port:
Note in the image above the source is “external” and the destination is the IP address of the load balanced virtual server we created previously. Set the rule to “Allow,” and log traffic if you wish.
The configuration can be tested by access the virtual IP address (through a web browser in this example) and determining which web server you have reached. If the services are configured in a round robin manner, a second attempt will send you to the second member server in the pool.
This completes the configuration of load balancing services in your vCloud Director environment. For those that haven’t yet upgraded to the latest version of the suite, these services were available in previous versions, but through API. Also, the API can still be used in the latest version for those that despise working with GUI’s or wish to automate some creation and deployment of these services and features.
Get notification of new blog postings and more by following Harry on Twitter: @HarrySiii