Home > OS >  Load Balancing is not working on below configuration of VMs
Load Balancing is not working on below configuration of VMs

Time:12-28

  1. Created 2 Ubuntu VMs in same availability Set, region, virtual network with apache2 installed.
  2. Renamed the index.html of both the VMs to: "This is VM1", "This is VM2".
  3. Created Internal Load Balancer with the below Configuration:
  • Front End IP Configuration: Same VNet, Dynamic Assignment, Zone-Redundant as Availability Zone
  • Back End Pool: Selected 2 VMs on the bepool
  • Health Probe: TCP Protocol, Port 80
  • Load Balancing Rule: TCP - 443 Port, Selected the created bepool and health probe, TCP Reset - Enabled, Idle Time out - 4 minutes
  • Inbound NAT Rules - Same as LB Rule but the port is 80.

The Problem is: When I copy the Front End IP of the Load Balancer and pasting in the browser, it is not showing any output like:

enter image description here

On VM Side, I have enabled the ports 80, 443, and 22 in the NSG for both of the VMs.

If that output comes, then I can hit the refresh page many times to see the load is distributing between the two VMs that shows "This is VM1" from VM2.

CodePudding user response:

I tried to reproduce the same in my environment and got the results like below:

I have created a virtual machine with:

  • VM 1 as availability zone zone 1 with Inbound port as HTTP(80) and SSH (22)
  • VM 2 as availability zone zone 2 with inbound port as HTTP(80) and SSH (22)

Then I have installed Apache web server Renamed the index.html for both vm like below:

Vm1

enter image description here

VM2

enter image description here

Created a load balancer type select as public in frontend ip created new public ip:

enter image description here

Added two virtual machines in backend pool and Add health probe. After creating load balancer verify public Ip address are same assigned in your both virtual machine.

Then add Load balancer rule port 80 like below:

enter image description here

Now, when I copy the Frontend IP of the Load Balancer and pasting in the browser I got result successfully like below:

enter image description here

enter image description here

Sometimes if we refresh, we can't redirect to another server keep being active on the server open another tab refresh it it will redirect multiple vm

Update

I have created two ubuntu vm with availability set on same region and vnet of Apache installed.

enter image description here

Then created with Internal Load Balancer:

enter image description here

Then added same Front End IP -> Back End Pool -> Health Probe -> And Load Balancing Rule TCP as 80 port

According to MSDocs

If your application hosted in the backend VM of an internal load balancer is trying to access another application hosted in the same backend VM over the same network interface, it's an unsupported scenario and will fail.

You need to create another test virtual machine with windows server to access RDP with same virtual network or while peering vnet you can access it while peering Basic LB has some limitations over Vnet peering

I have created another Vm and connected to remote desktop here, when I try to access Front end IP of the Load Balancer, I got result successfully like below.

enter image description here enter image description here

  • Related