Expand description
NODE HEARTBEATS — the Lease a node renews to prove it is alive.
★ WHY THIS EXISTS. A Node was registered once at boot with a hardcoded
[{type: Ready, status: True}] and nothing ever updated it again. The
kube-node-lease namespace was seeded and coordination.k8s.io was
served, but no Lease was ever written or renewed. The consequence is
the worst kind of monitoring failure: a node that has crashed,
partitioned, or been powered off reports Ready forever. A scheduler
keeps placing pods on it; kubectl get nodes shows a healthy cluster;
nothing ever transitions to NotReady.
★ WHY A LEASE AND NOT A STATUS WRITE. Upstream moved node heartbeats to
coordination.k8s.io/v1 Lease precisely because writing
Node.status every few seconds is expensive — the object is large,
every write wakes every Node watcher, and on a big cluster that traffic
dominates the apiserver. A Lease is a tiny object whose only job is to
carry renewTime. engenho gets the same property for the same reason,
and gets it in the shape every existing tool already reads.
★ LIVENESS IS DERIVED, NEVER ASSERTED. Ready is computed from the
lease’s age against a grace period. Nothing writes “I am healthy” —
a node proves it by renewing, and stops proving it by failing to. That
inversion is the entire point: an asserted condition survives the death
of whatever asserted it, which is exactly the bug being fixed here.
★ CLOCK-INJECTED AND PURE, so the whole grace-period curve is tested without sleeping.
Enums§
- Node
Readiness - A node’s readiness, DERIVED from how stale its heartbeat is.
Constants§
- GRACE_
PERIOD - How stale a lease may get before the node is judged
NodeReadiness::Stale. - LEASE_
NAMESPACE - The namespace node leases live in.
- RENEW_
INTERVAL - How often a node renews its lease. Upstream’s default.
Functions§
- find_
ready_ condition - Find the
Readycondition in a Node’sstatus.conditions, if present. - lease_
key - The store key for a node’s lease.
- lease_
value - Build the
Leaseobject for a node. - project_
ready_ condition - Project the
Readycondition a Node’s Lease implies onto that Node. - readiness
- Judge a node from the age of its last heartbeat.
- ready_
condition - The
Readycondition to publish onNode.status.