Verify Load balancing Azure Container Service

139 Views Asked by At

I am using the Azure Container Service with Kubernetes orchestrator and have an app deployed on a cluster with 3 nodes. It has 5 replicas. How can I verify load balancing in action e.g. I want to be able to see that every time I hit the external IP I am being routed to perhaps a different node. Thanks.

1

There are 1 best solutions below

1
On

The simplest solution is to connect (over ssh for example) to 3 nodes and run WinDump there. In order everything is working properly you will be able to see what happens on every node.

Also here is Microsoft documentation for testing a load balancer: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/tutorial-load-balancer#test-load-balancer

The default Load Balancer which are available to your Windows Azure Web and Worker roles are software load balancers and not so much configurable however they do work in Round Robin setting. If you want to test this behavior this is what you need to do:

  • Create two (or more) instances of your service with RDP access enabled so you can RDP to both instances
  • RDP to your both instances and run NETMON or any network monitor solution in it.
  • Now access your Windows Azure web application from your desktop You need to understand that when a network connection is made from your desktop the connection is still alive based on network settings (default 60 seconds) so you need to wait until default timeout is passed to access your Windows Azure web application again.
  • When you will access your Windows Azure Web application again you can verify that seconds time the request went to next instance. BE sure to pass the connection timeout otherwise your request will be keep handled by same instance.

Note: If you dont want to use RDP, you sure can also create a test ASP.NET page to write some special code based on your specific instance which will show you that this page is specific to certain instance. The best way to do is to read the Instance ID as below:

int instanceID = RoleEnvironment.CurrentRoleInstance.Id;

If you want to have more control over Windows Azure Load Balancing, i would suggest using the Windows Azure Traffic Manager which will help you to route the traffic to your site via Round-Robin, Performance or backup based scenario. More info on using Traffis Manager is in this article.