Kubernetes中kube-node-lease命名空间的作用是什么?
Let's break this down clearly—first covering what this namespace does, then figuring out why your kubectl get all command isn't returning results.
What's the purpose of kube-node-lease?
As you noted, this namespace exists to manage lightweight node heartbeats for availability tracking. Kubernetes uses two methods to check if nodes are healthy:
- Full
NodeStatusupdates: These are larger payloads sent periodically, which can add unnecessary load to the API server. - Lease objects: Each node gets a corresponding Lease in
kube-node-lease—these are tiny, infrequent updates that serve the same availability-checking purpose without the overhead of full status reports.
This feature launched as beta in Kubernetes 1.13 and was enabled by default in most clusters, including 1.15.
Why kubectl get all -n kube-node-lease returns nothing
Here's the key gotcha: kubectl get all doesn't actually fetch every resource type. It only includes a predefined set of common resources like pods, deployments, services, and jobs. Lease objects belong to the coordination.k8s.io API group, which isn't included in the "all" alias.
To see the Lease objects for your nodes, run this command instead:
kubectl get leases -n kube-node-lease
Or to be fully explicit about the resource type:
kubectl get leases.coordination.k8s.io -n kube-node-lease
You should now see one Lease object per active node in your cluster.
Official documentation context for Kubernetes 1.15
While dedicated docs for kube-node-lease were a bit sparse in 1.15, you can find details in two core places:
- The Kubernetes API reference for the
Leaseresource (undercoordination.k8s.io/v1beta1for 1.15) - The node lifecycle documentation, which covers how heartbeats (including leases) are used to determine node health
If you still don't see leases after running the correct command, double-check that the NodeLease feature gate is enabled (it should be on by default in 1.15).
内容的提问来源于stack exchange,提问作者Ivan Aracki

