Skip to content

Load Balancer Management

Note

The load balancer can be managed in the Admin via: Settings -> Load Balancers.

We run HAProxy on each and every container node. For clusters, they will keep a duplicate copy of the current configuration, as well as, any certificates installed.

This way, in the event of an IP failover even, the other load balancer is already running and ready to start serving requests.

IP Settings

Public IP This is the Floating IP Address for your cluster. If you're running a single container node, then this will be the primary IP of that node.
Server IPs This is a comma separated list of IP Addresses accessible from the controller. This is how the controller will connect to the Load Balancer and install any configuration
Internal IPs These are the internal ip addresses (also a comma separated list) of the load balancer. This will be the IP that the load balancer will connect to the container from.
If you have a separate container network attached to the node, you will enter the IP address of the node.

SSL Settings

You must install a Wildcard SSL certificate for the LoadBalancer. The LoadBalancer will not start without one.

During the installation process, a self-signed certificate was automatically generated and installed to the load balancer. To install a valid certificate, you have two options:

  1. Purchase a wildcard certificate and install it yourself, using the Custom Certificate field on the load balancer's edit form.
  2. Use the built-in ACME service to generate a wildcard certificate for free. Turn on Enable Automatic SSL Certificate on the load balancer.

The self-signed certificate keeps serving until the ACME certificate is active.

How automatic certificates work

The certificate covers the load balancer's domain and *.<domain>. A wildcard can only be validated over DNS, so the controller needs to publish a validation record at your DNS provider. It does this with its bundled cert-issuer, which works with any lego DNS provider. The load balancer's domain doesn't have to be hosted by ComputeStacks, and ComputeStacks doesn't need to run any DNS server for it.

Configure the provider once, under ACME Certificates in the admin settings:

Setting Value
DNS Provider The lego provider code, such as cloudflare or route53.
DNS Provider Credentials The provider's environment variables, one KEY=value per line, using the names on the provider's lego page. Blank lines and lines starting with # are ignored. The value is stored encrypted, and the settings list shows only how many variables are stored.
DNS Alias Zone Optional. A zone at the same provider. See below.

Until DNS Provider is set, load balancer certificates aren't issued or renewed. Certificates for your customers' own domains are not affected by these settings. Leave Enable Job on in the same section, because turning it off also stops customer domain certificates.

Validating in the domain's own zone

With DNS Alias Zone blank, the provider must manage the load balancer's domain directly, so the credential must be able to write TXT records in that zone. The controller writes _acme-challenge.<domain> itself. If that name already holds a CNAME, remove it.

Validating through a DNS alias zone

If the credential shouldn't touch the zone the load balancer's domain lives in, set DNS Alias Zone to a zone the provider manages, such as acme.example.net. The controller then writes the validation record in that zone, and the load balancer's domain delegates to it with a single permanent CNAME. For a load balancer with ID 3 and the domain a.fra.example.net:

_acme-challenge.a.fra.example.net. CNAME lb3.acme.example.net.

This applies to every load balancer with automatic certificates, even when the domain is hosted at the same provider. The alias zone doesn't need to exist in ComputeStacks.

  1. Set DNS Alias Zone.
  2. Open the load balancer's edit form. It shows the exact record, next to Enable Automatic SSL Certificate.
  3. Add that CNAME at the DNS host that serves the domain. The target must match exactly; any other target is reported as invalid.
  4. Click Deploy (the rotate button on the load balancer list), or Validate Domain, to re-validate the domain.

Don't share an alias zone

Don't share one alias zone between controllers. Load balancer IDs on different controllers overlap, so their lb<id> names would collide. Give each controller its own zone.

Domain checks

The load balancer list has a Domain Check column that shows whether each domain is Valid, Invalid, or Never checked, with the date of the last check. To run the check on demand, click Validate Domain on the load balancer. If the domain validates and automatic SSL is on, a certificate is ordered only when one is needed: none exists yet, the current one expires within 30 days, or it doesn't cover the domain. Re-validating a load balancer with a current certificate never reissues it.

The check also runs again when one of the load balancer's public or proxy addresses is added, changed, or removed. After upgrading from an earlier release, click Validate Domain on any load balancer that shows Never checked.

The check requires:

  • an A or AAAA record at the domain, where every address is one of the load balancer's own;
  • a wildcard *.<domain> CNAME that points to the domain itself;
  • with a DNS alias zone, the _acme-challenge CNAME described above.

Until the domain is valid, nothing can be deployed into that availability zone. The event log shows the specific problem; see Load balancer domain not valid for the event codes.

Certificate health

The load balancer list has a Certificate column. It shows the days left before expiry, in red under 14 days and amber under 30. After failed attempts it also shows how many in a row failed and when the next retry runs. Click the days-left label to open the certificate page, which shows the same and the cause in the latest certificate event.

The ACME Certificates section of the admin settings warns when load balancers have no DNS provider, when the credentials are empty or invalid, and when certificates failed to renew on their last attempt.

Retries

Each certificate backs off on its own after a failure, so one broken load balancer doesn't hold up the others:

Failure Next automatic attempt
Configuration or validation failure After 6 hours.
Rate limit When the certificate authority allows, or after 1 hour if it doesn't say.
Any other error After 5 minutes, doubling each time up to 1 hour.

Validate Domain and Deploy on a load balancer always try immediately. When a certificate has less than 14 days left and its last attempt failed, the controller also sends an alert to the error tracker once a day.

To retry from the command line, open a shell in the controller container with cstacks container, then run the following, where 3 is the load balancer's ID. It prints the result and the event's details. Use all to reissue every load balancer certificate.

bundle exec rake "lets_encrypt:issue_lb[3]"

The task only works on load balancers that have Enable Automatic SSL Certificate on. The controller checks that the validation record has propagated using its own resolver. If you just changed the domain's nameservers and the old ones are still cached, set RESOLVER_LIST to use public resolvers for that run:

RESOLVER_LIST=1.1.1.1,8.8.8.8 bundle exec rake "lets_encrypt:issue_lb[3]"

Upgrading to controller 9.9

From 9.9, certificates are issued through the DNS provider above, and renewals fail unless you prepare first. The full ordered procedure, including the case where a domain is still hosted on the old PowerDNS nameservers, is in Upgrading to 9.9: load balancer certificates.

Note

The controller's DNS zone editor and PowerDNS integration are deprecated and will be removed in a future release. Load balancer certificates no longer use them.