Concepts
Load balancers
A highly available HAProxy pair with an IPv4 address that fails over in about a second, TLS termination, health checks and IPv4 or IPv6 members.
A load balancer is two HAProxy VMs on different hosts, each with a leg on one of your private networks. They share
one public IPv4 address with VRRP when it is created with the IPv4 add-on (public_ipv4: true; without it the load
balancer is IPv6-only): the active VM holds it, and when that VM or its HAProxy stops, the other takes the
address within about a second, without the control plane. Each VM also serves the same frontends on IPv6 on its own
public /64.
Creating one#
curl -X POST https://cloud.ankra.app/v1/load-balancers \
-H "Authorization: Bearer $ANKRA_CLOUD_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "zone": "se-sto1", "name": "web", "network_id": "<network-id>" }'
That load balancer is IPv6-only: it gets a public IPv4 address only when you ask for one with "public_ipv4": true
(the paid IPv4 add-on; public_ipv4 defaults to false), and a zone without a public IPv4 pool a load balancer can use
refuses that with 400, saying why. When every address is taken the answer is 503.
In some zones, Stockholm among them, public IPv4 addresses are attached to single hosts. A load balancer's IPv4 address there counts against your public IPv4 quota and depends on that one host: the two load balancer VMs protect you against losing a VM, not against losing the host that carries the address. While that host is down the address does not answer, until it returns or we move the address to another host. The IPv6 address does not depend on it, so publish both if you can. Automatic failover of the address is not something to rely on yet.
The answer is 202 with a load_balancer.create operation, done once both VMs run and are configured. The zone needs
two hosts with room (503 otherwise).
A create that times out because its zone could not be reached, for example during a zone outage, leaves the load
balancer in error only for a while: Ankra Cloud starts the same operation again by itself, five minutes after the
failure and then backing off to once an hour, and the load balancer turns running once the zone serves it again. A
create refused for good (an invalid request, a quota) is not retried; delete the load balancer instead.
Internal load balancers#
Create the load balancer with "internal": true to keep it off the internet. It takes an address on its private
network (private_address in the answer), reserved so no server is given it, and serves every frontend there. A pair
moves that address between its two VMs the same way a public one moves its IPv4 address. The VMs admit the frontends'
ports only from the network's IPv4 subnet and its IPv6 ULA /64, and the load balancer publishes no public address:
public_ipv4, public_ipv6 and public_ipv6_addresses stay empty.
curl -X POST https://cloud.ankra.app/v1/load-balancers \
-H "Authorization: Bearer $ANKRA_CLOUD_TOKEN" \
-H 'Content-Type: application/json' \
-d '{ "zone": "se-sto1", "name": "internal-api", "network_id": "<network-id>", "internal": true }'
Reach it from servers on the network, from networks routed to it, or from your own devices through a
VPN gateway that connects the network. internal cannot be combined with
"public_ipv4": true (400), and it is fixed at creation: to make a load balancer public, create a new one.
Frontends, backends and members#
- A backend has a
mode(tcporhttp), abalancealgorithm (roundrobinby default,leastconn,source) and a health check. - A member is an address and port in a backend, with a
weight(0–256, default 100) andenabled. The address is an IPv4 host of the private network, an address on its IPv6 ULA /64, or a global IPv6 address such as a server'spublic_ipv6, so IPv6-only servers sit behind the one IPv4 address. - A frontend listens on a port and forwards to a backend, taking its mode.
Configuration changes take effect without an operation: each change bumps configuration_generation, the new
HAProxy configuration is validated on both VMs with haproxy -c and reloaded. is_configuration_applied turns true
when both have it.
Health checks#
health_check is { type, path, expected_status, interval_seconds, rise, fall }. A TCP check connects to the member;
an HTTP check sends GET <path> and expects expected_status (for example 200-399); none never checks. The
defaults are TCP every 2 s, rise 2, fall 3.
TLS#
Upload certificates with POST /v1/load-balancers/certificates: the PEM chain (leaf first) and an unencrypted private
key (RSA of at least 2048 bits, ECDSA or Ed25519). The key is sealed at rest, never returned or logged, and reaches the
load balancer VMs only inside their configuration. A tls frontend terminates TLS with 1 to 16 certificates: the
first answers clients without SNI, the others are chosen by SNI. HTTP backends behind TLS get
X-Forwarded-Proto: https and HTTP/2 via ALPN. A plain HTTP frontend with redirect_to_https answers every request
with a redirect to HTTPS.
Pricing and limits#
A load balancer costs €1.49 a month for each of its VMs, disks included, plus €4.00 a month for every public IPv4
address it holds, billed per hour held. No address is part of a price. With the IPv4 add-on it holds its frontend
address, and each VM holds an address of its own that is charged where it is a public IPv4 address. A highly available
pair therefore costs at most 2 × €1.49 + 3 × €4.00 = €14.98 a month, and €6.98 where the VMs' own addresses are not
public ones; the usage summary shows a public_ipv4 line for every VM address that is charged. Without the add-on it
holds no IPv4 address and a pair costs €2.98. Ankra assigns the addresses; you do not choose them or their range. An
account holds at most 5 load balancers and 100 certificates; a load balancer takes at most 50 frontends.
For a simpler IPv4 entry point for IPv6-only servers, a network edge with the
load_balancer role may be enough.