How to configure Affinity and Anti-affinity rules for VMWare DRS
Steps to configure Affinity Rule – VM to VM
Step 1:
To configure VM to VM affinity rule, login to vCenter Server, right click on the VMWare Cluster and then click on the “Edit Settings”.
Step 2:
On the Cluster settings, click on Rules and then click on add to create and configure affinity and anti-affinity rules.
Step 3:
On the rule tab, specify the name of Rule. Under type we can see three options i.e. “keep virtual machines together, separate virtual machines and Virtual Machines to Hosts”.
a) If you want some of the VMs to be hosted on the same VMWare ESXi servers then select the option “Keep Virtual Machines Together”.
b) If you want some of the VMs to be hosted on separate ESXi hosts then select the option “Separate Virtual Machines”.
c) If you want Virtual Machine to be hosted on the particular ESXi Server then select the option “Virtual Machines to Hosts”. The biggest disadvantage of this option is that if would not allow you to vMotion the VM to another VMWare ESXi host.
Step 4:
For this practical, we’ll specify the Rule’s name as KVMTRule and select the type “Keep Virtual Machines Together”.
Click on Add to add Node01 and Node02 VMs and then click on OK twice.
Step 5:
This rule would ensure that Node01 and Node02 machines are hosted on the same ESXi host.
For testing you can try to host Node01 and Node02 on ESX01 and ESX02 respectively.