Reference Project Architecture:
In this lab, I am going to perform how to work with VMware vSphere Distributed Resources Scheduler (DRS).
VMware vSphere Distributed Resource Scheduler (DRS) is a utility that balances computing workloads with available resources in a virtualized environment. It helps to manage a cluster of physical hosts as a single computer resource.
For example, when you assign a VM to a cluster, DRS finds a suitable host for that VM to run. DRS helps to distribute load balanced across the cluster by places VMs an appropriate host to enforce cluster-wide resource allocation policies including reservation, priority and limits. When a VM is powered on, DRS produces an initial placement of the VM on a host according to the resources allocation and load balance. DRS uses vMotion to migrate VM to other hosts when it requires. Additionally, When a new physical server is added to a cluster, DRS allows VM to immediately take benefit of the newly allocated resources because it distributes the running VMs.
VMware vSphere DRS benefits include:
- Dedicated infrastructures for individual business units
- Centralised control of hardware parameters
- Continuous monitoring of hardware utilisation
- Load Balancing
- Virtual Machine Placement
- Resource Pools
- Coordinating the Storage DRS
- Prioritisation of resources according to application importance
- Downtime-free server maintenance
- Optimisation of energy efficiency
- Power Management and Reduction of cooling costs
The task lists for the lab 24:
- Create a Load Imbalance
- Create a DRS Cluster
- Verify Proper DRS Cluster Functionality
- Create, Test, and Diable a VM-VM Affinity Rule
- Create, Test, and Disable an Anti-Affinity Rule
- Create, Test, and Disable a Virtual Machines to Host Affinity Rule
- Log in the VMware vSphere web client portal: https://vCenter Server Appliance Name.domainname:9443/vshpere-client/# or VMware vSphere Client via root user and password.
Steps for the task: Create a Load Imbalance
In this task, I will perform how to create a load imbalance across the hosts.
Step 1: Before creating a load Imbalance, You need to migrate all the VMs to one host. You need minimum four VMs on one host to testing imbalance activity. If all of your VMs are not the same host, Migrate them by using the VMware vSphere vMotion.
Step 2: Go to Home ->vCenter -> Hosts and Clusters
Step 2: Select Lab Cluster [ I named my cluster as Lab Cluster] and Click the Related Objects -> Virtual Machines tab in the inventory
Step 3: Power on each of your VMs by clicking on “Power On” icon or Right click each VM and select Power On.
Step 4: I ran “cpubusy.vbs” script on each of four VMs for making CPU busy of VMs. You need to start an instance of the “cpubusy.vbs” with command prompt[ I hope your instructor gave it to you before performing this lab]. Right click on “cpubusy.vbs” and Select “Open with Command Prompt“. and run this script on your four VMs for making CPU busy running.
Steps for the task: Create a DRS Cluster
A DRS Cluster is the group of VMware ESXi hosts and those hosts are associated VM with shared resources and a shared management interface.
Step1: Select Home -> vCenter -> Hosts and Clusters. Righ click on the “Lab Cluster” [ lab Cluster is my cluster name, name of the cluster can be different based on user preference] and select “Setting“
Step2: Select vSphere DRS and Click “Edit“
Step3: Select DRS Automation level “Manual“. Note: DRS offers three level of automation: Manual, Partially Automated, Fully Automated. Manually Automated means DRS will give you a recommendation based on DRS affinity, anti-affinity rules, Resource availability and workload of the system.
Manually Automated means DRS will give you a recommendation based on DRS affinity, anti-affinity rules, Resource availability and workload of the system. You need to apply that recommendation manually on your system.
Now select the Migration Threshold: Aggressive. Note: In the production Environment, Company usually maintains the central position as a default threshold. Click OK to apply the changes
Migration Threshold: In this lab, I tested HA with aggressive migration threshold because I wanted to migrate VMs faster. But real practice is in the production environment, they keep it in the center.
Steps for the task: Verify Proper DRS Cluster Functionality
In this task, I will demonstrate how to verify the proper DRS Cluster Functionality
Step 1: Click Home->vCenter->Hosts and Clusters. From the “Lab Cluster” inventory object, click “Monitor” and click on the “vSphere DRS” tab. Click on the “Run DRS Now” button. Note: When you clicking on “Run DRS Now“, immediately DRS start to evaluate the cluster and provide the recommendation without waiting standard time period 5 minutes before generating recommendations.
Step 2: Now Click on the Summary tab of lab Cluster to check the vSphere DRS status for checking load imbalance. Now you can see on the screenshot, the load is imbalanced.
Step3: Go to the monitor->vSphere DRS -> CPU Utilisation. In this Screenshot, you can see “Sum of the Virtual machine CPU utilisation -per host” status. Host one:vesxi01 is more than 50% occupied, on the other hand, the esxi02 host is 0% CPU utilizations.
Step 4: Now click on Recommendations tab, Click on “Run DRS Now” again and “Apply Recommendations” button
Step 5: Press the “Refresh” button in the vSphere Web Client after waiting a few minute. You will see in the Recent Tasks, The VM has started spread across the two hosts.
Step 6: Result of the DRS functionality: The following screencast you can see the workload has been balanced between two hosts simultaneously.
Go to the Virtual machine, Press Ctrl + C to stop “cpubusy.vbs” in each machine. After that, Close the VM console
Steps for the task: Create, Test, and Diable a VM-VM Affinity Rule
A VM-VM Affinity rule means the selected individual VM should run on the same host or be kept on a separate host based on the type selection during configuring affinity rule. Affinity Rule applied for keep VMs in the same host. On the other hand, Anti-Affinity rule is kept VMs on a separate host.
Step1: Select Lab Cluster in the inventory, Click the “Related objects” and click the Virtual Machines” tab. You can see two VM machines has been running on the each host.
Step2: Right Click ” Lab Cluster” and select “Settings”.
Step 3: Select “DRS Rules” and Click “Add“. A Cluster setup dialogue box is displayed.
Step 4: In the name section, give an Appropriate name ” Co-locate your name VMs” as an example. This the “Enable Rule” and Type: “Keep Virtual Machine together“. Now Click on “Add“
Step 5: Select the VMs machines which you want to include in the affinity rule of keep VMS together. I selected four objects.
Step 6: Click “OK” after all setup done. The result of the rule will be “All the objects of VMs” I selected here is going to migrate to the same host.
Step 7: Select Monitor ->vSphere DRS -> Recommendations. Now click on “Run DRS Now” for evaluating the cluster configuration.
Click on “Apply Recommendations“.
Now you can monitor Recommendation is applied from “Recent Tasks“.The recommended VMs has migrated to the recommended host using vMotion interface.
Step 8: Testing the Affinity rule: Now you can see the effect of the affinity rule. Click “Related Objects” -> Virtual machines tab and check the “Host” column. All of the VMs are running now “esxi02 host” after applied the affinity rule.
Note: If you don’t see the “Host” column on the window. Click the right button of the mouse on the status column heading bar and select “show and hide column” and select “Host”.
Step 8: Disable the affinity Rule: Right-click on “Lab Cluster” in the inventory object and select “Settings”.
Step 9: Select the “Affinity Rule” from the “DRS Rules” and click “Edit”
Step 10: Uncheck the “Enable Rule” to disable the affinity rule on the system. Click “Ok“
Steps for the task: Create, Test, and Disable an Anti-Affinity Rule
In this task, I am going to show how to configure an Anti-Affinity Rule, testing, Disable and delete it. When you apply an Anti-Affinity rule on the DRS Cluster, DRS assures that the specific VMS are kept on the separate hosts.
Step 1: Right-Click “Lab Cluster” in the inventory and select “Settings“
Step 2: Select the “DRS rules” pages and Click on “Add“.
Step 3: Perform the following action to create an Anti-Affinity rule” that I showed on the following Screenshot.
Step 4: Go to the “Monitor ->vSphere DRS” tab. On the Recommendations page, Click on ” Run DRS Now”
Now click on the “Apply Recommendations” button to enforce the anti-affinity rule.
Now you can monitor the process migration from the “Recent Tasks”. The VMs with anti-affinity rules applied to them are migrated to another ESXi host in the cluster.
Step 5: Testing the Anti-Affinity Rule: Go to the “Related Objects” and Virtual machines. Click the host column, you can see that one VM is now running on the separate ESXi hosts.
Step 6: Disable and Delete the Anti-Affinity Rule: Right-click on the “Lab Cluster” from the inventory objects and select “Settings”
Select the “DRS Rules” in the left pane and click the rule that you created for anti-affinity and click “Edit”. Deselect the “Enable Rule” for disable anti-affinity rule in the cluster.
Click on the “Delete” button to delete the “Anti-Affinity rule” from the cluster. Click “Yes” to delete the DRS rule.
Steps for the task: Create, Test, and Disable a Virtual Machines to Host Affinity Rule
The rule of the Virtual Machines to host Affinity specifies that the members of a selected virtual machine DRS group can run on the members of a specific host DRS group based on the rule configuration.
Step1: Create a Virtual Machines to Host Affinity Rule: Right click on the Lab Custer – > Settings
Select “DRS Groups” in the left pane of the settings page and Click “Add”
Now you get a Create DRS Group wizard. Type the name of the group and select the type as ” VM DRS Group”
Select the list of the VMs object on which you want to apply this rule.
Now you need to create another group ” Host DRS Group”.
Type the appropriate Name and select the type of the group: Host DRS Group“. Then “Ok“
Select the host group from the cluster and In my case, I selected both hosts for checking the balance in the cluster.
Now you need to go DRS rules for applying the group setup. DRS rules -> Add. Give the name of the rule appropriate name and select ” Enable Rule”. VM and host group Select that DRS Group, you already created for VM and Host groups. And Select “Must run on the host in groups” condition.
Click “Lab Cluster” -> Monitor-> vSphere DRS tab. Click “Run DRS Now. After clicking on the run DRS now, DRS will start to evaluate the state of the cluster and make a recommendation based on the DRS rule. Then “Apply the Recommendations”
Step 2: Testing the VM to host Affinity rule:
For the testing purpose, I changed the DRS Host group. I applied this VM to Host Affinity Rules to the host one” vesxi01
Now you can see, after changing the host group. DRS recommended the VM to migrate the host vesxi01 that one was previously in the Esxi02 because of the effect of the VM groups. All VMS must run on the same group host.
In this task, I wanted to migrate a VM from vesxi01 to Esxi02. But It did not allow me to migrate because of the VM to host affinity rule violations cause. Click on “Cancel”
Step 3: Disable the VM to host Affinity rule: Right click “Lab Cluster” in the inventory objects and select Settings.
Select DRS Rules in the left panel of the DRS cluster settings. Select the Rules: That you created, Click ” Edit” and deselect the “Enable Rule” to disable the VMs to Host affinity. Click “Ok”.
Thank you 🙂