Cycle de vie
Starting bouine
bouine serve --config /etc/bouine/config.yaml --log-format jsonOn Kubernetes the StatefulSet container runs this command via the Helm
chart (see deploy/helm/bouine/templates/statefulset.yaml). The
--log-format json flag ensures structured logging for aggregation.
Startup sequence
- Config loaded and validated.
- Storage tiers initialised (hot → warm).
- Admin server starts on
listen.admin(default:9000). /readyzreturns200once all listeners are bound.- Cluster join (if
listen.clusteris set): memberlist contacts seed nodes with retry (every 2s for up to 60s). Join succeeds once at least one peer besides self is discovered. StatefulSet headless Service must havepublishNotReadyAddresses: truefor DNS to resolve during startup. - Data-plane listeners start on
listen.http,listen.https. - Active health checks begin for all upstream pools.
Readiness vs liveness
| Probe | Endpoint | Meaning |
|---|---|---|
| Readiness | /readyz | All listeners bound, ready for traffic. |
| Liveness | /healthz | Process alive, can serve admin requests. |
Kubernetes will not route traffic until /readyz returns 200. A
failed liveness probe triggers a pod restart.
Stopping (graceful shutdown)
bouine uses a shutdown.Sequencer (internal/runtime/shutdown) that
runs registered steps in order, each with a time budget:
- Mark not ready —
/readyzreturns503. Kubernetes stops sending new connections. ThepreStophook sleeps one readiness period to let in-flight probes propagate. - Drain data-plane listeners — stop accepting new connections, finish in-flight requests within budget.
- Leave cluster —
memberlist.Leavewith a timeout so peers remove this node from the hash ring. - Flush storage — WAL sync, warm-tier segment close.
- Close admin — final metrics scrape window, then shutdown.
The total budget is terminationGracePeriodSeconds (Helm default: 40s).
Manual stop
kill -TERM <pid>
# or on Kubernetes:
kubectl delete pod bouine-0SIGTERM triggers the sequencer. SIGKILL (after grace period) is a hard kill — avoid if possible.
Config updates
bouine does not support live config reload. Config changes require a rolling pod restart. This is intentional: storage, cluster, and TLS settings cannot be safely reconfigured at runtime, and keeping reload out of the critical path removes a class of race conditions.
On Kubernetes, update the ConfigMap and rolling-restart:
kubectl rollout restart statefulset/bouineThe graceful shutdown sequence (below) ensures zero-5xx rolling updates when combined with a PodDisruptionBudget and readiness probes.
Drain (Kubernetes rolling update)
During a rolling update, Kubernetes sends SIGTERM to the old pod. The graceful shutdown sequence (above) handles draining.
Best practices
- Set
terminationGracePeriodSeconds≥ 30s (Helm default). - PodDisruptionBudget (
minAvailable: 1) prevents draining all replicas simultaneously. - The
preStopsleep ensures the endpoints controller removes the pod from the Service before connections stop. - Monitor
bouine_inflight_requeststo confirm drain completes.
Rolling update order
For a 3-replica StatefulSet:
bouine-2is terminated and drained.- New
bouine-2starts, passes readiness, joins cluster. bouine-1is terminated and drained.- … and so on.
The consistent-hash ring rebalances automatically as nodes join/leave.