Leases
Kubernetes uses the Lease API to communicate kubelet node heart beats to the Kubernetes API server. For every Node
, there is a Lease
object with a matching name in the kube-node-lease
namespace. Under the hood, every kubelet heart beat is an UPDATE request to this object, updating the spec.renewTime
field for the Lease. The Kubernetes control plane uses the time stamp of this field to determine the availability of this Node
.
See for more details.
FEATURE STATE:
Starting in Kubernetes v1.26, each kube-apiserver
uses the Lease API to publish its identity to the rest of the system. While not particularly useful on its own, this provides a mechanism for clients to discover how many instances of kube-apiserver
are operating the Kubernetes control plane. Existence of kube-apiserver leases enables future capabilities that may require coordination between each kube-apiserver.
The SHA256 hash used in the lease name is based on the OS hostname as seen by kube-apiserver. Each kube-apiserver should be configured to use a hostname that is unique within the cluster. New instances of kube-apiserver that use the same hostname will take over existing Leases using a new holder identity, as opposed to instantiating new lease objects. You can check the hostname used by kube-apisever by checking the value of the kubernetes.io/hostname
label:
Expired leases from kube-apiservers that no longer exist are garbage collected by new kube-apiservers after 1 hour.