Search code examples
google-compute-engineload-balancinggoogle-cloud-load-balancer

Google cloud TCP LB to let work RTMP and HTTP(S)


I have a compute engine instance group and i need to have one static ip (with proxy LB) and need to grab HTTP(S) and RTMP requests. I need to attach this proxy to an external domain -> example.com

I've already tried to use HTTP lb(can't work RTMP), and TCP lb (can't work HTTP requests), but maybe there is some missconfiguration or I need to make HTTP request in some specific way to work on TCP load balancer?

The perfect solution is that when i make requests to example.com, both HTTP and RTMP requests needs to works, workarounds are good too. Now all works, but example.com is pointed to the IP of 1 managed instance, so if the managed group scale and that specific instance "die", example.com point to an useless IP.

I need to manage both requests (RTMP and HTTP) on the same backend (group instance)


Solution

  • As per my understanding, you have the following requirements

    1) Static external IP with Proxy LB

    2) Need to grab HTTP(S) and RTMP requests.

    3) Proxy is attached to the external domain for example example.com

    4) The backend should be Managed instance group

    Based on the requirement and considering GCP load balancing options:

    1) HTTP(S) load balancer is not an option as it will not work with RTMP

    2) SSL Proxy LB is not an option as it doesn't support port 80 (user mentioned about HTTP)

    3) TCP Proxy LB is not an option as it doesn't support port 80, therefore, will not support HTTP.

    4) Network TCP/UDP LB seems like the possible option for this scenario as it supports any external ports for Load Balancing but the problem is it doesn't have proxy feature, it just a pass through LB.

    A summary of the port supported by GCP LB can be found following this link Supported external ports for differ GCP LB and summary of Cloud load balancers.

    Google Cloud Platform does not offer a proxy type load balancer that will simultaneously handle HTTP on port 80 and another plain old TCP protocol.

    Considering all the information, the best option for this scenario is to build your own proxy VMs and add them to a target pool behind a network load balancer. In that way, Network Load balancer's IP will be exposed (Requests to example.com translate to Network LB's IP) and the proxy feature will be provided by a pool of VMs working as target pool for that Network Load Balancer. The reason for having multiple proxy VM behind Network LB is to eliminate a single point of failure as well as redundancy.

    Network LB <----> Proxy VMs <--> Backend VMs

    Or if you need managed instance group and autoscaling then

    Network LB <--> Proxy VMs <--> Internal LB <--> Managed instance group

    In this setup, the proxy VMs and the ILB need to be in the same region as ILBs are regional.

    Additionally, if you need some guidance on how to configure proxy VM, GCP documentation on "Configuring an instance as a network proxy" might provide some good guidance.

    It worth to mention that Stack Overflow is generally for developers and Server Fault is aimed at system and network administrators.