Skip to main content
Create a load balancer
Last update:

Create a load balancer

  1. Select the configuration and network.
  2. Create a task force.
  3. Create rules and HTTP policies.

Select the configuration and network

  1. В control panels go to Cloud platformBalancers.

  2. Open the tab Balancers.

  3. Click Create a balancer.

  4. Select region and pool in which the balancer will be created.

  5. Select configuration depending on the project load.

  6. Enter the name of the balancer.

  7. Optional: enter a comment — any additional information about the balancer, it will only be displayed in the control panel.

  8. 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 that it has a free IP address for the load balancer port.
  9. Specify the IP address in the subnet, a free address that will be assigned to the balancer.

  10. Optional: Connect a public IP address. If there is no free public IP address available, create a new IP address. The private subnet on which you create the balancer must be prepared for connecting a public IP address.

  11. Click Further.

Create a task force

  1. Open the tab Servers.

  2. Optional: to change the name target group, press , enter a name and press .

  3. Select the traffic assignment protocol that the balancer uses to send traffic to the target group. The following combinations of protocols are available for accepting traffic on the balancer and assigning traffic to the target group:

    • 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.
  4. A default port will be automatically selected for the selected protocol — change it if necessary. The port value will be common to all servers in the group.

  5. Mark the servers to be added to the target group.

  6. Specify settings for each marked server:

    6.1 Select the IP address.

    6.2 Optional: change the port.

    6.3 Specify the server weight — this is a proportional measure, denotes the share of requests that the server handles. If the weights are the same, the servers serve the same number of requests. If, for example, there is one server in a group 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.

    6.4 Optionally, to direct traffic to a server only when other servers in the group are unavailable, check the checkbox Reserve.

  7. Open the tab Algorithm.

  8. Select query distribution algorithm — Round Robin or Least connections.

  9. Optional: to enable the method Sticky Sessions and check the box Sticky sessions and select a session ID. For APP-cookie ID, enter a cookie name.

  10. Open the tab Accessibility checks.

  11. Select type accessibility checks. Once a group is created, the type of check cannot be changed.

  12. If you selected the HTTP validation type, specify the request parameters — method, path, and expected response codes.

  13. Specify the check interval — the interval in seconds at which the balancer sends check requests to servers.

  14. Specify the connection timeout — the maximum time to wait for a response in seconds, must be less than the interval between checks.

  15. Specify the success threshold — the number of successful accesses in a row, after which the server is put into a working state.

  16. Specify the failure threshold — the number of unsuccessful requests in a row, after which the server is suspended.

  17. Optional: to add another target group, tap Add a target group and set it up.

  18. Click Further.

Create rules and HTTP policies

  1. Select protocol receiving traffic on the balancer — TCP, UDP, HTTP or HTTPS. Prometheus option is also available for customization load balancer monitoring.
  1. For the selected protocol, the default port on which the balancer will listen to traffic will be automatically selected — change it if necessary.

  2. Select a target group. Groups are available to which you can balance traffic on the selected one protocols receiving traffic.

  3. Optional: expand unit Advanced rule settings and specify connection settings:

    • for incoming requests to the balancer — specify the connection timeout and maximum connections;
    • for requests from the balancer to servers — specify the connection timeout, inactivity timeout and TCP packet waiting timeout.
  4. Optional: to add another rule, press Add rule and go to step 1. There is no limit to the number of rules.

  5. Check the total cost of the balancer.

  6. Click Create a balancer.