HAProxy + Keepalived¶
This page is the starting point for HAProxy and keepalived, the haproxy role: the containers haproxy and
keepalived, on the network nodes of the example inventory, selected by the tag haproxy. The same play holds the 49
per-service loadbalancer includes, and each of them also carries its service tag. The lists below say where the study
covers how to operate it, its impact, its dependencies and the evidence, what to check around a run and what stays open;
the service card follows them.
Where to look¶
Operate¶
- Scenario: Reconfigure a single service
§2
(
-t haproxy reconfigureon an unchanged cloud) - Command: Reconfigure a single service §1.2, Command quick lookup by tag
Impact and risk¶
- What the tag executes (
haproxy): Tags §3 and Tags §3.1, rowshaproxy; the haproxy play under a service tag: Tags §2.3 - Risks: R8
Dependencies¶
- Dependencies: Component dependencies §1, Component dependencies §2
Evidence¶
- Fact sheet: fact sheet A §1;
haproxy-config: fact sheet A §2 - Image side: Kolla images §5 (rows
haproxy,keepalived) - Also: handlers: Tags §5
Before and after a run¶
- Pre-execution checklist, step 5 (health gates): before the run, check HAProxy backends all UP. Repeat after each batch.
- Pre-execution checklist, step 7 (scope): add
--skip-tags haproxywhen the frontends are not meant to change. - Tags §3.1, row
haproxy: safe on its own "yes if nothing reports a change, since the restart handlers then never run CODE"; with a change, batch withANSIBLE_SERIAL=1 … reconfigure. Prerequisites: facts of every backend host; certificates if TLS is on. - R8, precautions for a HAProxy config change:
ANSIBLE_SERIAL=1for haproxy changes;--skip-tags haproxywhen you don't intend to change frontends. - R22, inventory reordering (haproxy, mariadb, glance, nova-conductor, keystone groups): keepalived priorities change. Precautions: treat inventory order as configuration; never reorder casually.
- Reconfigure a single service
§3,
verification of
-t <svc> reconfigure: before, a diff of/etc/kolla/haproxy/services.d/<svc>*.cfgagainst the previous version; after,docker ps --filter name=haproxyshows whether HAProxy restarted.
Known limits and open points¶
- Known bugs and limitations, row
haproxy: restart instead of reload; staleservices.dfiles never removed; keepalived priority from inventory order; upgrade "Stopping all slave keepalived" without anenable_keepalivedguard and with raw interface names. Status: CODE; effect of the upgrade bugs NOT AVAILABLE. - Known bugs and limitations, second row
site.yml: placement haproxy include lackswhen: enable_placement. Status: CODE. - Q5: "HAProxy restart: VIP behaviour". Status: NOT AVAILABLE.
- What is not known, row "HAProxy restart": the sources do not establish whether keepalived drops or moves the VIP, and for how long; whether the node goes to FAULT; whether established connections are cut; whether nova and neutron get DB errors and instance metadata requests fail meanwhile; how HAProxy treats backends that are not up yet on a first deploy; the effect of the haproxy upgrade bugs.
- F3, "
docker_graceful_timeoutanddocker_client_timeoutare ignored" CODE: NOT AVAILABLE whether services started by a shell wrapper that does notexecthem (e.g.neutron-l3-agent,haproxy) receive SIGTERM at all. - fact sheet A §1.8, "Operationally
notable behaviour", items (A) to (I): any change means a full restart of haproxy on all haproxy nodes at once, never a
reload; whether a haproxy restart causes VIP failover or a VIP outage is NOT AVAILABLE; keepalived priority depends on
inventory order; stale frontends are never removed;
-t haproxyalso runscommonon haproxy hosts; upgrade "Stopping all slave keepalived containers"; things that run on every deploy, reconfigure and upgrade; non-local bind is needed; VRRP router id collisions. - fact sheet A §2.4, "Notable" for the
haproxy-configrole: stale files are not removed; the file of a service whoseenabledis false is left as it was; file name; facts are required; precedence. - Kolla images §6, item 15: the VIP follows the HAProxy stats socket only CODE; whether an HAProxy restart puts the node in FAULT, and for how long, is NOT AVAILABLE (keepalived semantics).
Service card¶
The rows of the card are explained in How to read a service card.
| Item | Value |
|---|---|
| Play | site.yml:126 |
| Tags | haproxy; each of the 49 per-service include_role … tasks_from: loadbalancer tasks in this play also carries its service tag |
| Play host patterns | haproxy |
| Node types in play (example inventory) | network |
| Node types running its containers | network |
| Containers | haproxy, keepalived |
deploy/reconfigure flow (tasks/) |
config-host → config → check-containers |
| Task files | check-containers.yml, check.yml, config-host.yml, config.yml, copy-certs.yml, deploy-containers.yml, deploy.yml, main.yml, precheck.yml, pull.yml, reconfigure.yml, stop.yml, upgrade.yml |
| Templates | haproxy.json.j2, haproxy_main.cfg.j2, haproxy_run.sh.j2, keepalived.conf.j2, keepalived.json.j2 |
| Handlers (definition order) | Restart haproxy container; Restart keepalived container; Waiting for haproxy to start; Waiting for virtual IP to appear |
| Key variables | enable_haproxy, enable_keepalived, kolla_internal_vip_address, kolla_external_vip_address, keepalived_virtual_router_id, kolla_enable_tls_* |
| Role dependencies | common (meta) |
Related¶
- Reconfigure a single service — a service tag renders the service's frontend and restarts HAProxy if it changed
- Tags §2.2 — handlers ignore tags, which is why
-t keystonecan restart HAProxy - Component dependencies §1 — every internal, admin and public endpoint and the DB address resolve to the VIPs
- MariaDB/Galera — HAProxy sends DB traffic to one active backend
- Chrony — in the example inventory
chrony-serveris the haproxy group, and the VIP is the internal time source - Pre-execution checklist — the eight checks before every production run
- Components — the other component pages