Schedule icon
Webhook icon
Assert icon
Request icon
Script icon
Set icon
If icon
SlackIncomingWebhook icon
Pause icon
Loop icon
Sleep icon
Fail icon
Log icon

Remove Permanently Dead rqlite Raft Nodes After Approval

Detect permanently unreachable rqlite Raft nodes, track trend in KV, and remove them from the cluster with operator approval and verification in Kestra.

Categories
DataInfrastructure

rqlite replicates its SQLite database across a cluster using the Raft consensus protocol. When a node permanently fails (a crashed host, a decommissioned instance that was never cleanly removed), it stays in the Raft configuration as an unreachable member. A dead voter is not just noise: it silently degrades the cluster's fault tolerance, since Raft still counts it toward quorum arithmetic for the configuration it belongs to. A 3-node cluster with one permanently dead voter has effectively lost its ability to tolerate the loss of any of its two remaining live nodes until that dead member is formally removed.

This blueprint provides an automated guard that queries rqlite's /nodes HTTP endpoint, correlates each node's reachable status against historical snapshots in Kestra KV to require unreachability persist across multiple consecutive audits (not a single transient network blip), requests human approval, calls rqlite's DELETE /remove API to remove the confirmed-dead node from the Raft configuration, and re-queries the node list to verify it is actually gone.

How it works

  1. Pre-flight Assertion: validate_inputs (io.kestra.plugin.core.execution.Assert) checks that the consecutive-run threshold and the per-run removal cap are both positive.
  2. Node Discovery: fetch_nodes (io.kestra.plugin.core.http.Request) calls GET /nodes on the rqlite HTTP API, returning each node's id, addr, api_addr, voter, reachable, and leader status.
  3. Triage: triage_nodes (io.kestra.plugin.scripts.python.Script) flags a node as a removal candidate only when it is reported unreachable, is not the current leader (a second independent safety check beyond the fact a leader must be reachable to have answered the request), and has been unreachable for min_consecutive_unreachable_runs consecutive audits, tracked per node ID in Kestra KV under inputs.cursor_key. Candidates beyond max_removals_per_run are deferred to a later run, prioritizing the longest-unreachable nodes first.
  4. State Persistence: save_tracker_kv (io.kestra.plugin.core.kv.Set) writes the updated per-node trend back to Kestra KV.
  5. Slack Triage Alert: When removal candidates exist, dispatch_slack_alert posts the affected node IDs, addresses, and how many consecutive audits each has been unreachable.
  6. Human Approval Gate: When auto_remediate is enabled and dry_run is false, pause_for_operator_approval (io.kestra.plugin.core.flow.Pause) halts execution until an operator resumes with approved: true.
  7. Remove and Verify: remove_dead_nodes (io.kestra.plugin.core.flow.Loop) calls DELETE /remove with the node's ID per approved node, waits briefly for the Raft configuration change to propagate, re-queries /nodes, and fails loudly via io.kestra.plugin.core.execution.Fail if the node is still listed.
  8. Resolution Notification: A confirmation card is posted to Slack once remediation completes, and the full audit manifest is archived in Kestra KV.
  9. Failure Handling: A flow-level errors block alerts Slack if cluster connectivity, authentication, or scripting fails unexpectedly.

What you get

  • Automated detection of permanently dead Raft nodes silently degrading cluster fault tolerance.
  • Historical trend tracking in Kestra KV so a transient network blip is never mistaken for a dead node.
  • A per-run removal cap that prioritizes the longest-unreachable node first instead of removing an entire batch at once.
  • Human-in-the-loop approval before any node is removed from the Raft configuration.
  • Post-removal verification that fails loudly instead of assuming the removal worked.

Who it's for

  • Platform Engineers and SREs operating rqlite clusters for distributed SQLite workloads.
  • Teams running rqlite across ephemeral or auto-scaled infrastructure where instances can disappear without a clean leave.
  • Incident responders cleaning up cluster membership after a host failure.

Why orchestrate this with Kestra

rqlite itself has no built-in alerting on node unreachability and no automatic removal of dead members: an operator has to notice and act manually, or script it themselves without any of the state tracking needed to avoid reacting to a transient blip. Kestra adds declarative scheduling, KV-backed trend state that requires persistence before acting, an interactive approval gate, and verified, auditable node removal on top of the raw rqlite API.

Prerequisites

  • A reachable rqlite cluster, version 7 or higher, with its HTTP API port (default 4001) reachable from the Kestra worker.
  • If the cluster has HTTP Basic auth enabled, a user with permission to call /remove (the remove permission); if auth is not enabled, leave the username and password secrets empty.
  • A Slack Incoming Webhook URL for triage and resolution notifications.

Secrets

  • RQLITE_USERNAME: rqlite HTTP Basic auth username, if the cluster has auth enabled. Leave unset otherwise.
  • RQLITE_PASSWORD: rqlite HTTP Basic auth password, if the cluster has auth enabled.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint for triage and resolution alerts.
  • RQLITE_GUARD_WEBHOOK_KEY: Secret authentication token protecting the on-demand webhook trigger.

Quick start

  1. Configure SLACK_WEBHOOK_URL and RQLITE_GUARD_WEBHOOK_KEY in your Kestra namespace secrets, plus RQLITE_USERNAME and RQLITE_PASSWORD if the cluster has auth enabled.
  2. Import this blueprint and set rqlite_url to any reachable node's HTTP endpoint.
  3. Run a manual execution with the default dry_run: true to audit current node reachability without mutating the cluster.
  4. Review the execution logs, Slack triage card, and the KV entry under inputs.cursor_key.
  5. Run with auto_remediate: true and dry_run: false to arm remediation; when dead nodes are detected, approve the pause_for_operator_approval task with approved: true and observe the verified removal.
  6. Enable the periodic_node_audit schedule trigger for continuous monitoring.

How to extend

  • Non-Voter Demotion Path: Before removal, add a branch calling rqlite's demote-to-non-voter API for a node that might still rejoin, reserving outright removal for nodes confirmed permanently decommissioned.
  • Minimum Cluster Size Guard: Add an input capping how small the cluster is allowed to shrink to, and skip removal if going below it.
  • PagerDuty Escalation: Add io.kestra.plugin.pagerduty.PagerDutyAlert when a removal candidate is also the only non-leader voter remaining, since that signals the cluster is one more failure away from losing quorum entirely.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.