Load balancers
Spread TCP and HTTP traffic over several servers, with health checks.
A load balancer has its own public IPv4 and IPv6 address and forwards traffic to its targets according to its services. Load balancers are billed hourly by type; see Pricing.
Types
The type sets how many services, targets and connections a load balancer supports. List them (public, no token):
curl https://api.odinex.cloud/v1/load_balancer_types
odx load-balancer-type listYou can change the type later (change_type). Moving to a smaller type fails with 409 limit_exceeded if the current
services or targets don't fit it.
Services
A service listens on a port and forwards to a port on the targets.
| Field | Meaning |
|---|---|
protocol | tcp or http |
listen_port | Port on the load balancer, unique per load balancer |
destination_port | Port on the targets; defaults to listen_port |
proxyprotocol | Send the PROXY protocol header to the targets (tcp only) so they see the client's address |
health_check | protocol (tcp or http), port, interval (default 15 s), timeout (default 10 s), retries (default 3); for http, a path and expected status_codes such as ["2??", "3??"] |
http.sticky_sessions | Send a client to the same target each time (http only) |
The load balancer does not terminate TLS. For HTTPS, use a tcp service on port 443 and terminate TLS on the targets
(add proxyprotocol if they need the client address).
The algorithm is round_robin (default) or least_connections.
Targets
| Type | Meaning |
|---|---|
server | One server in the same location |
label_selector | Every server in the project whose labels match, e.g. role=web; kept up to date as servers come and go |
ip | A public IP address |
Each target reports a health status (healthy, unhealthy or unknown) per service port. Traffic only goes to
healthy targets.
odx load-balancer create --name lb-1 --type lb11 --location fra1
odx load-balancer add-service --protocol http --listen-port 80 --destination-port 8080 lb-1
odx load-balancer add-target --label-selector role=web lb-1Make sure the targets' firewalls allow traffic from the load balancer on the destination and health check ports.