Saturday, April 14, 2018

Create and Configure VMware Clusters

Create and Configure VMware Clusters

For this objective I used the following documents:

Objective 5.1 – Create and Configure VMware Clusters

**ITEMS IN BOLD ARE TOPICS PULLED FROM THE BLUEPRINT**
Knowledge
  • Describe DRS virtual machine entitlement
    • DRS will calculate CPU and memory entitlements for virtual machines.  The host-local schedulers are actually responsible for supplying those resources to virtual machines and therefore also calculate CPU and memory entitlements for the virtual machines that reside on it.  There are two types of entitlements, static and dynamic entitlement. 
      • Static Entitlement
        • Static entitlement is user-defined
        • Defined by resource shares, limits and reservations
          • Shares:  are proportional and are weighted against other running virtual machines when contention occurs
          • Limits:  are the maximum amount of resources a virtual machine or resource pool can use, think of this as the maximum value
          • Reservations:  are the minimum amount of resources a virtual machine or resource pool is entitled to.  Memory entitlement backed by a reservation cannot be reclaimed even if it is not being used.  CPU entitlement can be “loaned out” to other virtual machines if it is not being used
      • Dynamic Entitlement
        • Dynamic entitlement is calculated by the DRS cluster and by the host-local schedulers, specifically the host-local CPU scheduler and the host-local memory scheduler.  Dynamic entitlement is flexible and will increase/decrease based on virtual machine demand, but will never increase passed its configured CPU/Memory size
          • CPU Entitlement
            • Based on the Active CPU, which is taken from %Run + %Ready MHz metrics of that virtual machine
          • Memory Entitlement – the three items below makeup memory entitlement (working set, memory overhead and 25% of idle memory)
            • Based on Active Memory; the working memory set of the virtual machine (actual physical RAM pages)
            • Includes memory overhead (this number varies)
            • Includes 25% of the idle memory
Create/Delete a DRS/HACluster
    • Create a DRS/HA Cluster
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the vDatacenter you want to create your DRS cluster in and select New Cluster (or Ctr+L)
        4. Type in a name for the cluster in the Name field
        5. Check the Turn On vSphere HA and Turn on vSphere DRS checkboxes > click  Next
        6. Choose an automation level (ManualPartially automated or Fully automated) > click Next
        7. Decide if you want to enable Power Management (DPM), set to OffManual or Automatic > click Next
        8. Enable Host Monitoring is checked by default; this enables heartbeats between the hosts
        9. Choose whether to enable or disable Admission Control (enabled by default)
        10. If you chose to enable Admission Control (recommended) choose an admission control policy:
          • Host failures the cluster tolerates (specify number of hosts)
          • Percentage of cluster resources reserved as failover spare capacity (choose a percentage for both CPU and Memory)
          • Specify failover hosts (designate hosts to use only in case of failover)
        11. Click Next
        12. Set the VM restart priority (Disabled, Low, Medium and High)
        13. Set the Host Isolation response (Leave powered on, Power off and Shut down)
        14. Click Next
        15. Choose whether to enable VM Monitoring (requires VMware Tools to be installed)
        16. Use the slider to choose the Monitoring Sensitivity
        17. Click Next
        18. Enable Enhanced vMotion Compatability (EVC) or leave it disabled > click Next
        19. Choose the Swapfile Policy for Virtual Machines; store in same directory as virtual machine or let the host choose a datastore > click Next
        20. Click Finish
    • Delete a DRS/HA Cluster
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to delete and select Remove
        4. Click Yes to confirm the removal operation
  • Add/Remove ESXi hosts from a DRS/HA Cluster
    • There are a few ways to add a host to a DRS/HA Cluster.  If you already have a host added to vCenter, but not part of a DRS/HA Cluster you can simply drag-and-drop the host into the cluster and specify the resource pool you want to use.  You can put all the virtual machines in the cluster’s root resource pool, or create a new resource pool utilizing the hosts existing resource pool
    • Add a new ESXi host to a DRS/HA Cluster
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the cluster you want to add a new host to
        4. Click Add Host
        5. Enter in the hostname or IP address in the Host field
        6. Enter in an administrative username/password > click Next
        7. If prompted, click Yes to accept the certificate of the unverified host
        8. Click Next
        9. Assign an existing product key or assign a new key for the host > click Next
        10. If you want to enable Lockdown Mode select the Enable Lockdown Mode check box > click Next
        11. Choose whether to use the cluster’s root resource pool or create a new resource pool based off the hosts resource pool > click Next
        12. Click Finish
    • Remove an ESXi host from a DRS/HA Cluster
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on host you want to remove and select Enter Maintenance Mode
        4. Remove the host
    • To remove the host only from the cluster, you can drag the host out of the cluster and drop it into the vDatacenter
    • If you want to completely remove it from vCenter, right-click the host and select Remove > click Yes to confirm removal of the host
  • Add/Remove virtual machines from a DRS/HA Cluster
    • There are three ways to add a virtual machine to a DRS/HA Cluster and two ways to remove them
    • Add virtual machines to a DRS/HA Cluster
        1. Anytime you add a host to a DRS/HA cluster all virtual machines that are registered on that host will be added to the DRS/HA cluster
        2. Whenever you create a new virtual machine the wizard asks you whether you want to place it on a DRS/HA cluster or a standalone host
        3. vMotioning a virtual machine will allow you to add it to a DRS/HA cluster either from a standalone host or another DRS/HA cluster
    • Remove virtual machines to a DRS/HA Cluster
        1. When you remove a host from a DRS/HA cluster all of the powered-off virtual machines that are still registered on the host will be removed as well. Because you have to be the host in maintenance mode prior to removing it, powered-on virtual machines will have already been migrated to another host or powered off
        2. You can vMotion a virtual machine from a host in a DRS/HA cluster to a standalone host
  • Configure Storage DRS
    • You configure Storage DRS globally for a datastore cluster, and then you can manually disable on a per virtual machine level if needed
    • Configure Storage DRS
        1. Log in to vCenter using the VI Client
        2. Navigate to the Datastores and Datastore Clusters view (View > Inventory > Datstores and Datastore Clusters or Ctrl+Shift+D)
        3. Right-click on the vDatacenter you want to create your datastore cluster in and select New Datastore Cluster…
        4. Enter in a name in the Datastore Cluster Name field
        5. Ensure the Turn on Storage DRS checkbox is checked > click Next
        6. Choose the automation level that you want to use, either No Automation (Manual Mode) or Fully Automated
        7. Click the Advanced Options button if you need to input any advanced options
        8. Once complete click Next
        9. To include I/O metrics in SDRS recommendations select the Enable I/O metric for SDRS recommendations
        10. Set your Storage DRS Thresholds; Utilized Space (default is 80%) and I/O Latency (default is 15ms)
        11. Click the Show Advanced Options hyperlink to set advanced option
          1. Use the slider to set the utilization difference between the source and destination hosts before SDRS will make a recommendation (default is 5%)
          2. Set frequency for which you want vSphere to check for imbalances (default is 8 hours)
          3. Set the I/O imbalance threshold using the slider; this setting determines how much imbalance SDRS will allow before making recommenadations
        12. Click Next
        13. Using the checkboxes select the host(s)/cluster(s) you want to add to this particular Datastore Cluster > click Next
        14. Select the datastores you want to add to the Datastore Cluster > click Next
        15. Review all your settings and click Finish
    • When creating a new virtual machine you can disable SDRS when you select the datastore cluster for the virtual hard disk locations.  If you leave it enabled, at the very end of the wizard you can check an option that will show you SDRS recommendations, which will recommend initial placement of the virtual hard disks and configuration file (must be stored together) and you can then apply that recommendation(s)
    • Once you have virtual machines created and living on a datastore cluster you can configure SDRS rules (Intra VM Affinity rule) on a per virtual machine basis
    • You can create a scheduled task to change SDRS settings during off-hours.  You would want to do this in order to automatically rebalance your datastore cluster while users are out of the office and the impact is negligible
    • Create SDRS Scheduled Task
        1. Log in to vCenter using the VI Client
        2. Navigate to the Datastores and Datastore Clusters view (View > Inventory > Datstores and Datastore Clusters or Ctrl+Shift+D)
        3. Right-click on the datastore cluster you want to schedule > click Edit Settings…
        4. Choose SDRS Scheduling from the left menu
        5. Click the Add button
        6. Choose a Start and End time and the Frequency (days of the week) in which you want it to run > click Next
        7. Configure your Start Settings; enter in a Description
        8. Choose which Automation level you want to start when the start date/time begins
        9. Select whether you want to enable the I/O metric for SDRS recommendations
        10. Use the sliders to configure utilized space and I/O imbalance threshold
        11. Click Next
        12. Configure your End Settings; enter in a Description
        13. By default you can use the Restore settings to the original configuration or you can uncheck that option and configure the options described in steps 8-10
        14. Click Next
        15. Click Finish
    • You can also set VMDK and VM anti-affinity rules as well as default Virtual Machine settings (default is whatever automation level you set when creating the datastore cluster  and Keep VMDKs together in the Datastore Cluster settings
  • Configure Enhanced vMotion Compatibility
    • Configuring Enhanced vMotion Compatibility (EVC)
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to enable EVC on and select Edit Settings…
        4. From the menu on the left select VMware EVC
        5. Click Change EVC Mode…
        6. Choose Enable EVC for AMD Hosts or Enable EVC for Intel Hosts
        7. For AMD Hosts select one of the following:
          1. AMD Opteron Generation 1
          2. AMD Opteron Generation 2
          3. AMD Opteron Fen. 3 (no 3DNow!)
          4. AMD Opteron Generation 3
          5. AMD Opteron Generation 4
        8. For Intel Hosts select one of the following options
          1.  Intel “Merom” Gen. (Xeon Core 2)
          2. Intel “Penryn” Gen. (Xeon 45nm Core 2)
          3. Intel “Nehalem” Gen. (Xeon Core i7)
          4. Intel “Westmere” Gen. (Xeon 32nm Core i7
          5. Intel “Sandy Bridge” Generation
        9. Click OK twice
  • Monitor a DRS/HA Cluster
    • There are multiple ways that you can monitor a DRS/HA cluster when connected to vCenter via the VI Client.  There are a number of pre-defined alarms for different HA events that will trigger based on default thresholds (there are no pre-defined alarms for DRS specifically)
    • You can look at DRS Recommendations, Faults and History through the DRS tab
      • When logged into vCenter go to the Hosts and Cluster view and select the Cluster that you want to monitor, in the right pane click on the DRS tab
    • On the summary page you can view a summary of vSphere HA and vSphere DRS along with some advanced items
    • Monitor a DRS/HA Cluster from the Summary tab
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Select the DRS/HA cluster you want to monitor
        4. On the right, click on the Summary tab
        5. In the vSphere HA pane you can view the status of the following items:
          1. Admmission Control – enabled or disabled
          2. Current Failover Capacity – how many hosts are available for failover
          3. Configured Failover Capacity – items listed here will be different depending upon the Admission control policy you are using
          4. Host Monitoring – enabled or disabled
          5. VM Monitoring – enabled or disabled
          6. Application Monitoring – enabled or disabled
        6. To view the HA Cluster Status click on the Cluster Status hyperlink
          1. Here you are presented with three tabs, hosts, VMs and Heartbeat Datastores.  These tabs are all read-only
        7. To view any HA configuration issues click on the Configuration Issues hyperlink
          1. Here you are listed with configuration issues, if any, for HA
        8. Cluster validity can also be visibly noticed when there is an issue, it will be marked as red if its invalid when the failover requirements are exceeded by the number of powered-on VMs
        9. In the vSphere DRS pane you can view the status of the following items:
          1. Migration Automation Level – fully automated, partially automated or disabled
          2. Power Manangement Automation Level – off, manual or automatic
          3. DRS Recommendations – number of DRS recommendations
          4. DRS Faults – number of DRS faults
          5. Migration Thresholds – lists setting you are using for priority 1-5 recommendations
          6. Target host load standard deviation – what the host load standard deviation SHOULD be
          7. Current host load standard deviation – what the host load standard deviation is as of the last DRS invocation (default is 5 minutes)
          8. Click the View Resource Distribution Chart to look at CPU/Memory utilizations per host
    • Monitor a HA Cluster using pre-defined vCenter Alarms
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Select the vCenter object (this is the topmost object in the tree)
        4. Click the Alarms tab on the right
        5. Click the Definitions button at the top
        6. Here are a list of the seven pre-defined HA alarms for vCenter
          1. Insufficient vSphere HA failover resources
          2. vSphere HA failover in progress
          3. Cannot find vSphere HA master agent
          4. vSphere HA host status
          5. vSphere HA virtual machine failover failed
          6. vSphere HA virtual machine monitoring action
          7. vSphere HA virtual machine monitoring error
        7. Right-click each alarm listed above and select Edit Settings in order to view the triggers, reporting, and actions for the alarm.  Here you can also add or remove triggers, enable reporting, and define actions to take when the alarm is invoked
        8. If desired, you can also create your own alarms
  • Configure migration thresholds for DRS and virtual machines
    • Migration thresholds are typically setup when creating a DRS cluster, but they can be modified if needed, and here is how to do it
    • Configure Migration Threshold on DRS Cluster
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Select vSphere DRS from the menu on the left
        5. Choose the desired migration threshold from the five different settings using the slider in the right-hand pane located under Fully Automated. Here are the different settings, from left-to-right:
          1. Apply only priority 1 recommendations – vCenter only applies recommendations to satisfy cluster constraints
          2. Apply priority 1 and priority 2 recommendations – vCenter applies recommendations that promise significant improvement to the cluster
          3. Apply priority 1, priority 2 recommendations and priority 3 recommendations — vCenter applies recommendations that promise good improvement to the cluster
          4. Apply priority 1, priority 2 recommendations, priority 3 and priority 4 recommendations — vCenter applies recommendations that promise moderate improvement to the cluster
          5. Apply all recommendations — vCenter applies recommendations that promise slight improvement to the cluster
        6. Click OK or Cancel when complete
  • Configure automation levels for DRS and virtual machines
    • DRS automation levels can be set on the DRS cluster (global for that particular DRS cluster) and can be set on individual virtual machines.  Setting DRS automation levels on a virtual machine will override the automation level that is set on the DRS cluster for that virtual machine
    • Setting DRS Automation Level on a DRS Cluster – normally done when creating DRS Cluster
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Select vSphere DRS from the menu on the left
        5. Choose the desired automation level from the right- hand pane
        6. Click OK or Cancel when finished
    • Setting DRS Automation Level on a Virtual Machine
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Select Virtual Machine Options from the menu on the left
        5. Select the Enable individual virtual machine automation levels checkbox
        6. The window below will display the lists of virtual machines and you can modify their automation level by clicking on the current set automation level and click the down arrow.  Select from the following options:
          1. Fully Automated
          2. Partially Automated
          3. Manual
          4. Default – this is listed as what’s configured globally for that DRS Cluster
          5. Disabled
          6. Click OK or Cancel when finished
  • Create VM-Host and VM-VM affinity rules
    • As you may have gathered from the topic title, there are two types of affinity rules that you can create; VM-VM affinity rules and VM-Host affinity rules
    • Within these two types of rules you can either specify them as affinity (together) or anti-affinity (separate)
    • VM-VM affinity rules – used to ensure certain virtual machines run on the same host or do not run on the same host
    • Creating a VM-VM Affinity Rule
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Under vSphere DRS select the Rules option
        5. Click the Add button
        6. Type a name for the new rule in the Name field (try and be descriptive)
        7. From the Type dropdown choose either Keep Virtual Machines Together or Separate Virtual Machines
        8. Click the Add button
        9. Select two or more virtual machines that you want to incorporate in the affinity rule > click OK
        10. Click OK twice
    • VM-Host affinity rules – used to keep virtual machines running on a particular host(s) or to ensure virtual machines DO NOT run on particular host(s). Before you can create a VM-Host affinity rules cannot be created until you create Virtual Machine DRS Groups and Host DRS Groups
    • Creating a VM-Host Affinity Rule
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Under vSphere DRS select DRS Groups Manager option
        5. Under the Virtual Machines DRS Groups click Add
        6. Enter in a descriptive Name
        7. Select virtual machine(s) you want to use in your VM-Host affinity rule from the left pane and move them to the right pane > click OK
        8. Under the Host DRS Groups click Add
        9. Enter in a descriptive Name
        10. Select host(s) you want to use in your VM-Host affinity rule from the left pane and move them to the right pane > click OK
        11. Under vSphere DRS select the Rules option
        12. Click Add
        13. Enter a descriptive Name
        14. In the Type dropdown select Virtual Machines to Hosts
        15. Choose which virtual machine group you want to use from the Cluster Vm Group dropdown
        16. Select which type of affinity you want for this rule from the dropdown, options are:
          1. Must run on hosts in group
          2. Should run on hosts in group
          3. Must Not run on hosts in group
          4. Should Not run on hosts in group
        17. Click OK when finished
        18. Click OK
  • Enable/Disable Host Monitoring
    • Enabling/Disabling host monitoring is straight forward and it allows each of the ESXi hosts within the cluster to send heartbeats over the network between each other; here is how to do it
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Click on vSphere HA
        5. In the right-pane select or deselect the Enable Host Monitoring checkbox to enable or disabled host monitoring, respectively
        6. Click OK or Cancel when finished
  • Enable/Configure/Disable virtual machine and application monitoring
    • VM Monitoring will restart virtual machines if the heartbeats sent to VMware tools within the guest aren’t responding or received within a set time.
    • Application monitoring will restart a virtual machine if the VMware tools APPLICATION heartbeats aren’t responding or received within a set time
    • Enable/Disable/Configure VM Monitoring and Application Monitoring
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Under vSphere HA select the VM Monitoring option
        5. Choose which level of monitoring you want to perform, either VM Monitoring Only or VM and Application Monitoring
        6. Below that you can set the Monitoring sensitivity using a slider, there are four different settings:
          1. Low – vSphere HA restarts the VM after no heartbeats are received within 2 minutes.  HA will restart the VM after each failure, but only up to 3 failures within a 7 day period
          2. Medium — vSphere HA restarts the VM after no heartbeats are received within 60 seconds.  HA will restart the VM after each failure, but only up to 3 failures within a 24 hour period
          3. High — vSphere HA restarts the VM after no heartbeats are received within 30 seconds.  HA will restart the VM after each failure, but only up to 3 failures within a 60 minute period
        7. Custom (click the checkbox) – from here you can specify your own values:
          1. Failure Interval (in seconds)
          2. Minimum uptime (in seconds)
          3. Maximum per-VM resets
          4. Maximum resets time window – set to no window or specify time in hours
        8. You can also change all of the settings above on a per-virtual machine basis by selecting the different options from the drop downs under Virtual Machine Settings in the VM Monitoring column and Application Monitoring column
        9. Click OK or Cancel when finished
  • Configure admission control for HA and virtual machines
    • I’m not going to cover how each of the admission control policies work, but I will walk you through enable/disabling and picking an admission control policy
    • Configure Admission control
        1. Log in to vCenter using the VI Client
        2. Navigate to the Host and Clusters view (View > Inventory > Hosts and Clusters)
        3. Right-click on the DRS/HA cluster you want to edit and select Edit Settings…
        4. Click on vSphere HA
        5. Under Admission Control in the right-pane select Enable or Disable
        6. If you select Enable you will need to select an admission control policy, select from the following:
          1. Host failures the cluster tolerates – specify number of hosts
          2. Percentage of cluster resources reserved as failover spare capacity
            1. Specify a percentage for CPU and a percentage for Memory
          3. Specify failover hosts – click the Click to edit hyperlink to choose which hosts you want to reserve for failover purposes
        7. Click OK or Cancel when complete
  • Determine appropriate failover methodology and required resources for an HA implementation
    • Determining which failover methodology and required resources are appropriate for vSphere HA will always depend on the environment and availability requirements of the organization.  Even if you aren’t using admission control, I can’t think of a single reason NOT to enable HA
    • Determining your required resources and the failover methodology go hand-in-hand with each other.  You need to look at the availability requirements, determine what resources you have to meet those requirements and then determine the best methodology.  In some cases you may need to allocate more resources or manage expectations with stake holders
    • There is no right answer that applies to every situation, but here are my suggestions when attempting to determine failover methodology and required resources to support that methodology
      • Know your availability requirements – this will be the foundation for making a proper determination
      • Identify which failover methodology meets those availability requirements and the pros/cons for that methodology
      • Ensure you have enough resources to sustain the failover methodology you chose based on requirements.  If you determine Specify failover hostsis the right policy, do you have idle hosts you can allocate?  If you want to use the Percentage policy (general best practice as it’s the most flexible), what percentage for CPU and Memory is free to handle your availability requirement?
    • I believe you can use the logical formula above to come up with a successful failover methodology, or you can come up with your own.
Tools

No comments:

Post a Comment