Skip to content
Odinex Cloud
Concepts

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 list

You 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.

FieldMeaning
protocoltcp or http
listen_portPort on the load balancer, unique per load balancer
destination_portPort on the targets; defaults to listen_port
proxyprotocolSend the PROXY protocol header to the targets (tcp only) so they see the client's address
health_checkprotocol (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_sessionsSend 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

TypeMeaning
serverOne server in the same location
label_selectorEvery server in the project whose labels match, e.g. role=web; kept up to date as servers come and go
ipA 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-1

Make sure the targets' firewalls allow traffic from the load balancer on the destination and health check ports.

On this page