Skip to main content
Create a load balancer
Last update:

Create a load balancer

  1. In Control Panel, go to Cloud PlatformBalancers.

  2. Click Create Balancer.

  3. Enter the name of the balancer.

  4. Select region and pool.

  5. Select balancer type based on the project load.

  6. Select a subnet:

    • private — traffic balancing will be performed only within the subnet. You can connect a public IP address to a private address — the balancer will be accessible from the Internet via NAT;
    • or public — the balancer will be accessible from the Internet and will be able to proxy requests from the public subnet to cloud servers on the private subnet. If you will be hosting cloud servers on the same subnet, choose a network of /28 or larger, or make sure it has a free port allocated — more on how many ports the balancer uses.
  7. Specify the IP address of the balancer — one of the free addresses in the subnet.

  8. Optional: connect a public IP address. If there is no free public IP address, create a new IP address. The private subnet on which you create the balancer must be connected to cloud router-to-external-network.

  9. Configure load balancer rule. Specify the protocol for the balancer and cloud server:

    • TCP-TCP is classic L4 balancing;
    • TCP-PROXY — client information is not lost and is transmitted in a separate connection header;
    • UDP-UDP — The UDP protocol is faster than TCP, but less reliable;
    • HTTP-HTTP — L7-balancing;
    • HTTPS-HTTP — L7 balancing with encryption and SSL certificate termination on the balancer.
  10. The default port will be automatically set for the selected protocol — change it if necessary. The port value will be common to all servers in the rule.

  11. If you choose the HTTPS protocol, add an SSL certificate to the rule so that the balancer can read the HTTPS request and use the HTTP protocol information for proper balancing. SSL certificate termination takes place on the balancer, the balancer transmits the data to the servers via HTTP.

    Select a certificate from the secrets manager or upload a new one.

    Certificates with an empty CN (Common Name) field are not supported in load balancers.

  12. Open the Servers tab and check the servers that will be added to the rule.

    For each server, select the IP address and enter the port.

    Specify server weight — this is a proportional measure, denotes the fraction of requests that the server handles. If the weights are the same, the servers serve the same number of requests. If, for example, a rule has one server with a weight of "2" and two servers with a weight of "1", the first server will receive 50% of all requests and the other two will each receive 25%. The maximum weight value is 256.

  13. Open the Algorithm tab and select request distribution algorithm — Round Robin or Least connections. Optional: to enable the Sticky Sessions method, check the Sticky sessions checkbox.

  14. Open the Checks tab and configure availability-checks.

  15. Open the Connections tab and specify connection-settings between:

    • incoming requests and balancer — specify the connection timeout and whether or not the number of connections is limited. When the number of connections is limited, specify the maximum number of requests;
    • balancer and servers — specify the connection timeout, inactivity timeout, and TCP packet waiting timeout.
  16. Optional: open the Headers tab and check HTTP request headers to be passed to servers.

  17. Optional: to add an additional rule, click Add Rule. There is no limit to the number of rules.

  18. Click Create Load Balancer.