Create loadbalancer inside a vnet with azure - azure

I want to create a load balancer for all my agents.
In the official docs I found a guide for an external load balancer, but I want to connect it with the api management so it has to be only visible in the vnet.
This post works if you only have one agent (you enter the private ip of the agent in your api route). But it does not handle the second agent.
Is it possible to use Azure API Management and Azure ACS (kubernetes) as frontend and backend?
So in my case I need to create a load balancer that handles all agents for the service and has a private ip in a vnet in that the api management service also is.

well, nothing prevents you from connecting api management to an external endpoint, so there's that.
and if you really want internal endpoint I doubt that it is possible, since a NIC can only be attached to a single load balancer. maybe if you detach agent nics from the external load balancer and attach them to internal load balancer... that might work, but looks like a solid hack.
other way around this might be using ACS engine to generate a template for you and alter the template to deploy internal load balancer.

As 4c74356b41 said, we can't add a VM to two backend pools (if your k8s create via azure portal, the agents in a VMSS.)
In your scenario, I think we can create a VM in ACS resource group, and install load balance software on it, make this VM work as a load balancer.
For example, we can use Haproxy to load balance the network traffic to agents.

Related

Azure Container Instance IP

I've created an Azure container instance with a Private IP. This is connected to a VNET so my Web Apps can communicate with it in a secure way. (This API has Bearer tokens also but I don't want to make it public).
However, when restarting the Container I get a new IP. Therefore I have to update the Env and restart my apps.
Is there a way to implement service discovery within Azure, so my Web Apps (and other services) know where this Container Instance is, especially when the container gets a new IP.
I am used to dealing with Pivotal and Consul but under Azure I don't have these tools.
In Pivotal I was able to fire up multiple instances and the platform would auto discover and load balance. At the moment, Azure feels very manual :(
Does azure have the ability to register a service under a host name that can then auto resolve?
Does Azure support load balancing when multiple instances are started with the same name?
For this kind of work maybe the best solution is to create an Azure service web app. The web app as public static IP link to your plan which does not change.
Inbound and outbound IP addresses in Azure App Service
With this solution your IP never change.
According to the documentation linked, you can find your inbound IP like this:
nslookup <app-name>.azurewebsites.net
and the outbound IP in powershell:
(Get-AzWebApp -ResourceGroup <group_name> -name <app_name>).OutboundIpAddresses

Inside load balancer in Azure

In Azure, I have 3 Web Apps (for simplicity):
Frontend website
Endpoint 1
Endpoint 2
The frontend website requests data from an endpoint.
Both endpoints are synchronized all the time (outside the scope of this question), but sometimes I need to do some maintenance on them, which gives me some downtime.
Can I somehow setup a loadbalancer only my frontend website can see, and get any of the online endpoints - like this:
The last line of this article says Internal Load Balancers might be the fit:
Can I use ILB on PaaS services (Web/Worker roles)?
ILB is designed to work with web/worker roles as well, and it is available from SDK 2.4 onwards.
Does anyone know of a guide, or have tried making this with Web Apps?
I dont think this is something you can achieve "natively" with load balancers. App Services are not actually bound to the VNet. Previously you could only use point-to-site vpn to connect them to vnet, right now there is a new vnet integration feature in preview which might allow you to use internal load balancers, but I doubt that, because they (load balancers) only allow to use virtual machines\scale sets\availability sets as backend pools.
Application gateways can be bound to the App Services. And they can be internal as well. You'd also need to restrict App Service(s) to receive traffic from anything that is not you Application gateway.
You can use traffic manager\front door for this sort of load balancing, but the endpoints won't be private

Trying to understand load balancing in azure cloud service

I am maintaining a azure cloud service which has 1 web role and few worker roles. The webrole has multiple instances. When I open the cloud service from the resources, I can see the service endpoint and public ip address. I want to understand how is the traffic load balanced in this azure cloud service. I searched for load balancers but I could not find it in the subscription. I was also not able to get the reference of some document which explains load balancing in the cloud service specifically.
Any info in this regard?
Long story short,
The default distribution mode for Azure Load Balancer is a 5-tuple hash. The tuple is composed of the source IP, source port, destination IP, destination port, and protocol type. The hash is used to map traffic to the available servers and the algorithm provides stickiness only within a transport session.
https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-distribution-mode
Internal load balancer is supported for cloud services. An internal load balancer endpoint created in a cloud service that is outside a regional virtual network will be accessible only within the cloud service.
I found these docs which might be helpful to you. These explain setting internal load balancer for cloud services.
Classic : https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-get-started-ilb-classic-cloud
ARM : https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-get-started-ilb-arm-ps
Just to make it clear, the information below is about classic services. For information about classic and resource manager model, see this page.
In cloud services you get a load balancer automatically configured when you create the service. If you want to configure it, you can do so using the service model.
The load balancer can be of two different types,
internal load balancer
external loab balancer
The internal one can only be accessed inside the cloud service, while the external one got a public IP. See this page for how to make an internal load balancer.
Load balancers keep track of the health state of the endpoints by regularly probing them. Check out this page for how to configure the probing. As long as the internal services return a HTTP 200, they are kept in the load balancers pool.
Have a look at this page for more general information on load balancers for cloud services.
Also, see this page as well. It contains a good information about the service.

How to expose a website on the new VMs in Azure?

I used to use the "classic" VMs to host test web sites on Azure, but now when I create a VM using the new Azure portal I don't get the option to create a cloud service when I create the VM and can't seem to figure out how to hook up the VM to a cloud service.
My requirement is simple, I have a third party BA web site that I need to install and test. The site gets installed and runs fine locally in IIS but I can't seem to expose it as a ".cloudapp.net" site.
Thanks in advance,
Vince
Cloud services do not exist in the new portal (known as ARM). Instead you should be creating a load balancer or traffic manager resource in front of the VM and then configuring access that way.
A number of considerations will be needed before picking which method to go with, for example traffic manager profiles can only be pointed at Web Apps, classic cloud services or ARM based network adapters on VMs with public IP addresses. Your public IP address must have a DNS name associated with it as well.
For load balancers, you have more options in some areas over traffic manager profiles but it really does depend on your requirements.
Personally I use traffic manager profiles for providing access to IaaS VMs.

How to do load balancing / port forwarding on Azure?

I am evaluating the convenience of moving to azure. Currently, I am trying to figure out how to balance the load and make routing for different websites on the same machine. I saw tutorials where a user created a separate LB on a different VM. I also found many articles about the possibility to balance the load using Azure load balancing.
So I assume both are possible, is that correct?
I would like to know how to connect between machines on azure. Would it be possible to do so using a local ip, machinename, or dns?
I also need to figure out how to forward traffic to different ports based on http header, is that possible without a seperate machine as load balancer? I see the endpoint config in my azure dashboard and found the official documentation, but unfortunately it's not enough for my understanding.
Currently, I am trying to figure out how to balance the load and make
routing for different websites on the same machine.
You can have different web sites on the same machine by configuring virtual hosting on IIS. This is accomplished using host header. VM, Cloud Service or even Websites supports this functionality. VMs and Cloud Services should be pretty straight forward. Example using websites:
Hosting multiple domains under one Azure Website
http://blogs.msdn.com/b/cschotte/archive/2013/05/30/hosting-multiple-domains-under-one-azure.aspx
I also found many articles about the possibility to balance the load
using Azure load balancing.
LB for VMs are as easy as creating a load balance set inside endpoint configuration wizard. Once you create a balance set, for example, enpoint HTTP port 80, you can assign this balance set to any VM on the same cloud service. All requests to port 80 would be automatically balanced across all VMs in the set.
So I assume both are possible, is that correct?
Yes.
I would like to know how to connect between machines on azure. Would
it be possible to do so using a local ip, machinename, or dns?
You just have to create a virtual network and deploy the VMs to it. Websites (through preview portal only), Cloud Services and VMs supports VNet.
Virtual Network Overview
https://msdn.microsoft.com/library/azure/jj156007.aspx/
I also need to figure out how to forward traffic to different ports
based on http header, is that possible without a seperate machine as
load balancer?
Not at this moment. Best you can have with native Azure Services is a 3-tuple (Source IP, Destination IP, Protocol) load balance configuration.
Azure Load Balancer new distribution mode
http://azure.microsoft.com/blog/2014/10/30/azure-load-balancer-new-distribution-mode/
depending on how you're deploying there's a couple of options:
first of all: LB sets in VM's in a cloud service. For this the Cloud service acts as the LB. this can only be achieved when using a standard sku VM.
second of all in Azure WebApps : load balancing is achieved automagically when deploying through standard means, since scaling is foreseen here.
Third of all there's Cloud Services with roles, who also do this "automagically".
Now none of that seem to apply to your needs. you can also start thinking about using traffic manager, something with a little more bite :-)
have you read this article by any chance? http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-load-balance/
I'd like to advise you to add different endpoints to your VM's work with traffic manager and ake sure you IIS has all the headers on the correct ports (cause i'm assuming that's what you're doing already)

Resources