8000 k3s: The drain gets 90 s from logind, not 45 by andsens · Pull Request #40 · nixos-homelab/shared · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions nix/modules/k3s/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ let
if [[ $(${kubectl} get node ${node} -o jsonpath='{.spec.unschedulable}') != true ]]; then
${kubectl} annotate node ${node} ${drainedAnnotation}=true --overwrite
fi
timeout 40 ${kubectl} drain ${node} --ignore-daemonsets --delete-emptydir-data --force --timeout=35s || true
# Within logind's InhibitDelayMaxSec below, with room for the calls above on a busy API
timeout 80 ${kubectl} drain ${node} --ignore-daemonsets --delete-emptydir-data --force --timeout=75s || true
'';
};
uncordon = pkgs.writeShellApplication {
Expand Down Expand Up @@ -282,8 +283,10 @@ in
];
# Container scopes have no shutdown dependencies, so systemd only kills them at the very end, after services
# they use (the NFS server) are gone. The kubelet stops the pods first when it gets logind's shutdown signal, and
# logind only waits InhibitDelayMaxSec for it (5 s by default) of the kubelet's 35 s (the groups below)
services.logind.settings.Login.InhibitDelayMaxSec = 45;
# logind only waits InhibitDelayMaxSec for it (5 s by default) of the kubelet's 35 s (the groups below). The drain
# holds a delay lock too: in example's NAS suite on a public runner the annotate and cordon took 13 s and the
# evictions, throttled by kubectl, outlasted 45 s, so logind rebooted before the drain was done
services.logind.settings.Login.InhibitDelayMaxSec = 90;
# The kubelet's shutdown marks the pods it stops as Failed, rejects (as Failed) the replacements that tolerate a
# NotReady node, and leaves them all behind (https://github.com/kubernetes/kubernetes/issues/139246). Draining
# first deletes them and keeps the replacements Pending, cordoned, until the node is back. It holds its own delay
Expand Down
0