azure

Configuring an Availability Set with the Azure Load Balancer

According to Microsoft definition, “An availability set is a group of virtual machines that are deployed across fault domains and update domains. Availability sets make sure that your application is not affected by single points of failure, like the network switch or the power unit of a rack of servers.”
Each virtual machine is assigned an update domain and a fault domain:

  • Update domains define the group of VMs that can be updated and restarted at the same period. During planned maintenance, only one update domain is rebooted at a time. By default, there are 5 update domains and you can configure up to 20 update domains.
  • Fault domain define a group of VMs that share a common set of hardware, network switches and power source.

VMs in an availability set are placed in at least two fault domains. Microsoft recommends combing the Azure Load balancer with an availability set to get the most application resiliency.


2 9 2019 5 59 02 AM

The Azure Load Balancer enables you to distribute incoming traffic across the collections of VMs in an availability set in a round robin manner. It automatically removes un-healthy VMs from rotation so that they are not routed traffic when they are unavailable.

You can create a virtual machine and an availability set at the same time. Or you create an availability set and then add VMs to it. Here, you create an availability set, launch 2 Ubuntu VMs instances and then add new VMs as part of the availability set. Then, lastly configure a Load Balancer with availability set.

Configuring an Availability Set for 2 VMs:
1. On the upper-left side of the Azure Portal, click on Create a resource, in the search resources, type Availability and select Availability Set.

Create a resource

2. On the Availability Set page, click on Create button.

2 6 2019 10 13 54 PM

3. On the Create availability set page, type or select these values:

  • Name: Type MSSERVERPRO-AS
  • Resource Group: Select MSSERVERPRO-ASA-RG01
  • Location: Select Southeast Asia
  • Fault domains: 2
  • Update domains: 5
  • Use managed disks: Yes(Aligned)

Select Create button.

2 6 2019 10 14 49 PM

4. Go to All resources, select on newly created Availability Set name MSSERVEPRO-AS.

2 6 2019 10 20 43 PM

5. On the MSSERVERPRO-AS Availability Set page, verify the Fault domains (2) and Update domains (5).

2 6 2019 10 22 45 PM

Create 2 Ubuntu virtual machines with Availability option:
1. On the upper-left side of the portal, select Create a resource > Compute > Ubuntu Server 18.04 VM.

2 6 2019 10 25 15 PM

2. In the Create a virtual machine page, type or select the following values in the Basics tab:

  • PROJECT DETAILS >
    • Resource Group: Drop down and select MSSERVERPRO-ASA-RG01
    • INSTANCE DETAILS > Virtual machine name: Type KTM-WEBSRV01
    • Region: Select Southeast Asia
    • Availability options: Drop down and select Availability Set
    • Availability Set: Drop down and select MSSERVERPRO-AS
    • Image: Drop down and select Ubuntu Server 18.04 LTS
    • Size: Select Standard D2s v3
  • ADMINISTRATOR ACCOUNT >
    • Authentication Type: select Password.
    • Username: ktmadmin
    • Password: *********
    • Confirmed Password: *****
  • INBOUNT PORT RULE >
    • Public Inbound ports: Select Allow Selected ports.
    • Select inbound ports: Drop down and select HTTP, SSH.
Related Post  Extend Azure Virtual Machine OS drive using Azure Portal

Create on Next: Disks button.

2 6 2019 10 27 07 PM
2 6 2019 10 35 03 PM

3. In the Create a virtual machine page, type or select the following values in the Disks tab:

  • DISKS OPTIONS >
    • OS disk type: Drop and select Standard SSD.
  • ADVANCED >
    • Use managed disks: select Yes.

     Then click on Next: Networking button.

2 6 2019 10 36 56 PM

4. In the Create a virtual machine page, type or select the following values in the Networking tab:

Make sure the following options are selected:

  • Virtual network: Drop and select MSP-ASA-VN01
  • Subnet: Drop and select FrontEnd-Subnet(10.1.4.0/24)
  • Public IP: Drop and select KTM-WEBSRV01-ip

Then click on Next: Management button.

2 6 2019 10 41 53 PM

5. In the Create a virtual machine page, select the following values in the Management tab and then click on Next: Guest config button.

2 6 2019 10 43 13 PM 2

6. In the Create a virtual machine page, in the Guest config tab, click on Next: Tags button.

2 6 2019 10 43 40 PM

7. In the Create a virtual machine page, type or select the following values in the Tag tab:

  • NAME: Type Name
  • VALUE: KTM-WEBSRV01
  • RESOURCE: select Virtual machine

      Then click on Next: Review+ create button.

2 6 2019 10 45 19 PM

8. In the Create a virtual machine page, select the Review + create tab. Review the settings, and then click on Create button.

2 6 2019 10 46 00 PM

9. On the Create VM overview page, you will get …. Your deployment is underway.

2 6 2019 10 46 39 PM

10. After few minutes, you will get “Your deployment is complete” screen. Click on Go to resource button

2 6 2019 10 51 17 PM

11. In the Availability set overview page, value 1 is displayed under Virtual machines. Verify that virtual machines status is running, and showing Fault domain (0) and Updates domain (0).

2 6 2019 10 54 46 PM

Follow the all these steps for second VM name KTM-WEBSRV02, with a Public IP, and all the other settings the same as KTM-WEBSRV01.

In the Availability set overview page, now value 2 is displayed under Virtual machines.

2 6 2019 11 03 25 PM

Connect to KTM-WEBSRV01 using SSH:

In the Azure Portal, on the Overview page for Virtual machine, copy the Public IP address under Public IP address.

2 6 2019 11 04 28 PM
2 6 2019 11 09 29 PM 1

Installing and configuring Apache

2 6 2019 11 13 34 PM
2 6 2019 11 15 26 PM
2 6 2019 11 16 27 PM 1

Modify the Apache2 Ubuntu Default page:

2 6 2019 11 22 27 PM

In the Azure Portal, on the Overview page for Virtual machine, KTM-WEBSRV01 copy the Public IP address under Public IP address.

2 6 2019 11 24 23 PM

Open the web browser and paste the KTM-WEBSRV01 Public IP address and press enter.

2 6 2019 11 24 54 PM
2 6 2019 11 27 52 PM

Follow the same steps on a second server KTM-WEBSRV02.

2 6 2019 11 32 35 PM

Open the web browser and paste the KTM-WEBSRV02 Public IP address and press enter.

Related Post  Using the Azure Portal to Create Virtual Networks, Add Subnets and Setting up a DNS Server Address
2 6 2019 11 33 32 PM
2 6 2019 11 34 12 PM

Configure Azure Load Balancer:
According to Microsoft definition, “Azure load balancer is a layer 4 load balancer that distributes incoming traffic among healthy virtual machine instances. Load balancers use a hash-based distribution algorithm. By default, it uses a 5-tuple (source IP, source port, destination IP, destination port, protocol type) hash to map traffic to available servers. Load balancers can either be internet-facing where it is accessible via public IP addresses or internal where it is only accessible from a virtual network. Azure load balancers also support Network Address Translation (NAT) to route traffic between public and private IP addresses.”

You can configure the load balancer to:

  • Load balance incoming traffic across your virtual machines.
  • Forward traffic to and from a specific virtual machine using NAT rules.

1. In the Azure Portal, click on +Create a resource, select Networking and then select the Load Balancer.

2 6 2019 11 38 23 PM

2. On the Create load balancer page, type or select the following values:

  • Name: Type MSSERVERPRO-LB
  • Type: Select Public
  • SKU: Select Basic
  • Public IP address: Select Create new.
    • Public IP Address field: Type MSPLB-PIP
    • Configure Public IP address > Assignment: Select Dynamic
  • Resource group: Select existing MSSERVERPRO-ASA-RG01
  • Location: Select Southeast Asia

      Then click on Create button.

2 6 2019 11 46 26 PM

3. On the Deployment succeeded box, click on Go to resource.

2 6 2019 11 48 10 PM

4. When the Load balancer is deployed, navigate to it the Azure Portal, Select Load balancers on the left menu, and double-click on LB name, MSSERVERPRO-LB.

2 6 2019 11 51 18 PM

5. In the Azure Portal, on the Overview page, Load balancer Dashboard page has opened. Under Settings, you have to configure Frontend IP Configuration, Backend pools, Health probes and Load Balancing rules.

2 6 2019 11 55 04 PM

6. Under Settings, select Frontend IP configuration, you do not have to do anything. Frontend IP address serve as ingress for the traffic.

2 7 2019 12 00 37 AM

7. Under Settings, select Backend pools, and then select Add button. Backend pool associated with the virtual machine Network Interface Card (NIC) to which load will be distributed.

2 7 2019 12 03 53 AM 1

8. On the Add a Backend pools page, type or select the following values

  • Name: Type Backendpool
  • Associated to : Drop down and select Availability set
  • Availability set: Select MSSERVERPRO-AS

        Then click on +Add a target network IP configuration

2 7 2019 12 06 50 AM

9. Select the VM from the Target virtual machine dropdown, and select the Network IP configuration for the VM from the Network IP configuration dropdown. Again, click on +Add a target network IP configuration.

2 7 2019 12 08 08 AM

10. Again Select the VM from the Target virtual machine drop-down, and select the Network IP configuration for the VM from the Network IP configuration drop-down. Then click on OK.

Related Post  Creating a Windows Virtual Machine and Availability Set at the same time using the Azure Portal
2 7 2019 12 09 16 AM

11. On the Backend pools page, expand Backendpool and make sure that both 2 VMs are listed.

2 7 2019 12 11 53 AM

Create a Load Balancer Health Probe:

Load balancer health probe allows the load balancer to monitor VM status. So, health probe dynamically adds or removes VMs from the load balancer rotation based on their response to health checks.

To create a health probe to monitor the health of the VMs:
1. Under Settings, select Health probes, and then click on Add button.

2 7 2019 12 12 56 AM

2. On the Add a health probe page, type or select the following values:

  • Name: Type healthprobe
  • Protocol: Drop down and select HTTP
  • Port: Type 80
  • Path: Type /health.html
  • Interval: 5
  • Unhealthy threshold: 2

Then click on OK button.

2 7 2019 12 14 54 AM

3. Under Settings, select Health probes, verify that healthprobe rule has created.

2 7 2019 12 17 17 AM

Create an Azure Load Balancing Rules:

A load balancer rule defines how traffic is distributed to the VMs. The rule defines the front-end IP configuration for incoming traffic, the back-end IP pool to receive the traffic, required source and destination ports, health probe, session persistence, idle timeout and floating IP (direct server return).

1. On the Load Balancer Dashboard, under Settings, select Load balancing rules, and then click on Add button.

2 7 2019 12 19 19 AM

2. On the Add load balancing rule page, type or select the following values:

  • Name: Type LB-Rule
  • Frontend IP address: Select LoadBalancerFrontend
  • Protocol: Select TCP
  • Port: Type 80
  • Backend port: Type 80
  • Backend pool: Select Backendpool
  • Health probe: Select healthprobe

Then click on OK button.

2 7 2019 12 22 47 AM

3. Verify that Load balancing rules has created.

2 7 2019 12 24 36 AM

Test the Load balancer:

In the Azure Portal, on the Overview page of MSSERVERPRO-LB, copy the Public IP address under Public IP address.

2 7 2019 12 34 09 AM

Go to the web browser, paste the MSSERVEROR-LB Public IP address and press enter.

2 7 2019 12 31 54 AM

Hit Refresh, you can get result from second server.

2 7 2019 12 31 23 AM

Check the health probe.

2 7 2019 12 35 52 AM

Clean up resources:

Clean up the all related resources when you no longer need them.

Summary:

I hope this article helps in configuring an availability set, launch Ubuntu VMs instance with Apache2 installed with modify Apache Ubuntu Default page, add VMs to availability set, create Load Balancer and lastly how to combine a Load Balancer with availability set to get the Apache2 application resiliency.


3 comments

Leave a Reply

Your email address will not be published. Required fields are marked *