Skip to content

Move the primary isolation check from the liveness probe to the primary lease #11738

Description

@gbartolini

Primary self-fencing on network isolation lives in the liveness probe. When the API server is unreachable, the probe pings every peer's failsafe endpoint. A failed probe makes the kubelet restart the pod about three probe periods (~30s) after the partition starts. That restart then goes through the normal smart shutdown path, so sessions that were already open can keep writing for up to smartShutdownTimeout (#11280).

The primary lease gives a faster and more precise signal for the same condition:

  • When the primary fails to renew its lease, it runs the peer-reachability check itself. If it should step down, it requests a fast PostgreSQL shutdown directly, without waiting for the kubelet.
  • The check runs as soon as renewal fails. The margin between RenewDeadline and LeaseDuration is the budget for check and shutdown to complete before a replica becomes eligible to promote.
  • The /failsafe endpoint also reports the responding instance's view of the target primary. A primary that can reach every peer but learns that someone else is now the target primary steps down too. Reachability alone could not detect that case.
  • The liveness probe's isolation logic is removed, and IsHealthy always reports OK.

This issue is being created after the PR (#11357), exceptionally, to group all the lease-related changes under the #11721 epic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement 🪄

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions