DigitalOcean load balancers, and what's behind them
A DigitalOcean load balancer is a managed service that distributes traffic to a group of backend resources, so a service does not depend on a single server. Duskwatch is an independent iPhone app for DigitalOcean, in development; it shows which droplets behind each load balancer are off, its rules and health check, and sends a push when it errors or nothing runs behind it.
Updated
- 2 casespush: errored, or no droplet running behind it
- 2 checksin a row before either push
- 200–399HTTP codes that pass a health check
- 3 typesshown: regional, network or global
01Backends
The droplets behind it
The screen lists the droplets behind the load balancer, assigned by name or by tag, each with its own state.
1 of 2 droplets behind it is off
web-02 is off and web-01 carries the traffic. The evidence comes from droplet status.
No droplets behind it
No droplet has the tag web.
02Alerts
A push when it errors or has nothing behind it
With alerts on, two cases send a push: DigitalOcean reports the load balancer errored, or not one droplet behind it is running.
- Both repeat until someone taps "I'm on it" or traffic has somewhere to go again.
- One droplet off out of two is that droplet's own push: the site is up, just thinner.
The permission load balancer alerts need, and incidents
Load balancer alerts use the same extra read-only permission as Kubernetes, certificate and firewall alerts; a team whose alerts predate it is asked once. During a DigitalOcean incident affecting load balancers in its region, the alert waits under the incident.
From DigitalOcean's docs
The API reports a load balancer's status as new, active or errored.
DigitalOcean API reference: load balancers (external link), verified
03Settings
Forwarding rules, health check and settings
Rules run from entry protocol and port to the target; without one, a load balancer accepts no traffic. Below sit the health check and the settings.
| Shown as | Meaning | Example |
|---|---|---|
| Checks | The protocol, port and path it requests | HTTP, port 80, path / |
| Every | Seconds between health checks | 10 seconds |
| Unhealthy after | Consecutive failures before traffic stops | 3 checks |
| Healthy again after | Consecutive passes before traffic returns | 5 checks |
The other settings on the screen
Type (regional, network or global), size, redirect from HTTP to HTTPS, sticky sessions, PROXY protocol and backend keepalive.
From DigitalOcean's docs
The unhealthy threshold is how many consecutive times a node must fail a health check before the load balancer stops forwarding traffic to it; the healthy threshold is how many passes it needs before traffic returns.
DigitalOcean docs: manage regional load balancers (external link), verified
An HTTP or HTTPS health check succeeds on a status code from 200 to 399; a TCP health check succeeds when the TCP handshake completes.
DigitalOcean docs: manage regional load balancers (external link), verified
04Certificates
Certificates on HTTPS rules
A certificate on an HTTPS rule lists lb-web under "Used by", so one that ends in 9 days is traced to the load balancer it would break.
Certificate expires in 9 d
static-example, used by lb-web. In use on a load balancer, so it also gets the certificate push.
Let's Encrypt renews itself
While DigitalOcean manages the domain's DNS. A custom certificate needs a new upload.
From DigitalOcean's docs
With DigitalOcean DNS managing the domain, a load balancer can use a Let's Encrypt certificate that DigitalOcean creates and renews automatically.
DigitalOcean docs: configure SSL termination (external link), verified
05Troubleshooting
Every droplet is on, but visitors get errors
The cause is usually inside a droplet, or between it and the load balancer.
- 1
Open each droplet behind it
Its metrics, recent restarts and firewall findings.
- 2
Hand off to your SSH app
Check the service itself.
- 3
Open the load balancer in DigitalOcean
Change the rules or the health check there.
From DigitalOcean's docs
Common causes of failed health checks include frozen backend software, a droplet firewall blocking the port, a service not listening on the private interface, an HTTP error status, and a PROXY protocol mismatch.
DigitalOcean docs: troubleshoot load balancer health checks (external link), verified
What Duskwatch doesn't do here
- No health check result per droplet: the API does not report it
- No load balancer push while some droplets behind it still run
- No editing forwarding rules, health checks or settings
- No creating, resizing or deleting load balancers
Questions
How do I know a backend droplet is down?
DigitalOcean stops sending traffic to a droplet after it fails the health check a set number of times in a row. Duskwatch shows which droplets behind the load balancer are off, from each droplet's own status.
Will I get a push when a load balancer has a problem?
Yes, with alerts on: when DigitalOcean reports it errored, or when no droplet behind it is running, and again when it works. One droplet going off while others run sends that droplet's push instead.
Which load balancer settings can I see?
Forwarding rules, the health check, type, size, HTTPS redirect, sticky sessions, PROXY protocol and keepalive. You change them in DigitalOcean.
Why does it show droplet status instead of the health check?
The load balancer's API object reports the health check's settings, not its result for each droplet. The finding says that its evidence comes from the droplet status.