Stop the CNPG probes from killing instances that are merely busy #43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tune-cnpg-probes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
spec.probesto the Postgres cluster. Two probes were tuned in opposite directions, because they mean opposite things.Liveness: it killed a healthy primary
On 2026-08-15 the primary was shut down by its own liveness probe. The
isolationChecklets a primary step down when it can reach neither the API server nor its replicas — a good property, since it prevents split-brain writes during a real partition. But the defaults areconnectionTimeout: 1000/requestTimeout: 1000, and during the Longhorn rebuild storm the API server simply took longer than a second to answer. The only replica was already broken, so there was no second signal to weigh against. The instance concluded it was isolated and stopped. Nothing was partitioned.At
instances: 2this check hangs on a single signal any time the replica is unavailable — which is exactly when you least want the primary to remove itself.Startup: it prevents a replica from ever catching up
An instance replaying WAL answers
the database system is not yet accepting connections. The defaultpg_isreadystrategy counts that as a failure, so a tight threshold makes kubelet kill the pod, recovery restarts from the beginning, and a slow replay turns into a loop that never converges.Readiness: deliberately untouched
Readiness is the one probe that should stay strict, because failing it only pulls an instance out of the read services rather than ending it.
readiness.type: streamingwith amaximumLagwould express "connected but lagging" far more precisely thanpg_isready, and it is the semantically right answer. It is not in this PR because I could not confirm how thestreamingstrategy behaves on a primary, and if it ever marks the primary not-ready thehomelab-postgres-rwservice loses its endpoints — an outage produced by the change meant to prevent outages. Worth doing, worth verifying on a scratch cluster first.Validation
Merging triggers a rolling restart of both instances, so it is worth landing at a deliberate moment rather than alongside other work.
Refs #39
🤖 Generated with Claude Code