stagger k3s startup using persisted control-plane rank#5819
Merged
rene merged 1 commit intolf-edge:masterfrom Apr 28, 2026
Merged
stagger k3s startup using persisted control-plane rank#5819rene merged 1 commit intolf-edge:masterfrom
rene merged 1 commit intolf-edge:masterfrom
Conversation
cc83c87 to
d8d78d6
Compare
Contributor
andrewd-zededa
left a comment
There was a problem hiding this comment.
Just a small request for live debugging, otherwise LGTM
Comment on lines
+631
to
+632
| sleep "$delay" | ||
| logmsg "staggered_cluster_startup_delay: delay complete" |
Contributor
There was a problem hiding this comment.
Can these be swapped? My thinking is after the day we're starting k3s and no longer are reviewing this log or cluster-init.sh to see why k3s isn't running. With the logmsg before the sleep a quick check in k3s-install.log on a live system becomes "ok check back in a moment"
Contributor
Author
There was a problem hiding this comment.
good catch. updated.
- When all cluster nodes power-on simultaneously, concurrent etcd joins can fail due to authentication races. This patch introduces a rank-based startup delay to serialize k3s restarts across nodes. - save_cluster_startup_rank runs each main loop iteration and writes this node's 0-based position (sorted by InternalIP) among control-plane nodes to /var/lib/cluster-startup-rank. - On the next boot, staggered_cluster_startup_delay reads the rank and sleeps rank * 25 seconds before k3s starts Signed-off-by: naiming-zededa <naiming@zededa.com>
d8d78d6 to
57fd0e7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5819 +/- ##
==========================================
- Coverage 19.52% 17.03% -2.50%
==========================================
Files 19 477 +458
Lines 3021 85762 +82741
==========================================
+ Hits 590 14609 +14019
- Misses 2310 69644 +67334
- Partials 121 1509 +1388 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rene
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PR dependencies
How to test and validate this PR
config an edge-node cluster w/ 3 nodes, and power all the nodes off and on
at the same time, and monitor each node will join the cluster in a deterministic
way, from the lowest to highest ip addresses.
Changelog notes
stagger k3s startup using persisted control-plane rank
PR Backports
Checklist
For backport PRs (remove it if it's not a backport):
And the last but not least:
check them.