Thursday, December 3, 2026 | London 11°C · Drizzle
DailyGlimpse

AI

How Kubernetes Scheduler Achieves High Availability: A Deep Dive into Leader Election and Lease Lock Objects

Technical Cloud Knowledge 3 min read

Overview

In a Kubernetes cluster, the scheduler is responsible for assigning pods to nodes. To ensure high availability (HA), multiple scheduler replicas can run simultaneously, but only one acts as the active leader. This article explains the leader election mechanism and the lease lock object that makes this possible.

Why Multiple Schedulers?

Kubernetes control plane components, including the scheduler, are often deployed with multiple replicas to avoid a single point of failure. However, only one scheduler instance should make scheduling decisions at a time to prevent conflicts. The leader election process ensures that exactly one scheduler is active, while others remain on standby.

The Leader Election Process

The leader election mechanism in Kubernetes uses a distributed lock stored in the API server. This lock is represented by a Lease object (or historically an Endpoint or ConfigMap). Each scheduler instance attempts to acquire the lock by updating the Lease object. The instance that successfully updates the Lease with a future expiration time becomes the leader.

Lease Lock Object

A Lease object is a lightweight resource in the coordination.k8s.io API group. It contains:

  • HolderIdentity: The identity of the current leader (e.g., the pod name).
  • LeaseDurationSeconds: How long the lease is valid.
  • AcquireTime: When the current leader acquired the lease.
  • RenewTime: When the leader last renewed the lease.
  • LeaseTransitions: A counter of leadership changes.

How It Works

  1. Each scheduler replica continuously tries to update the Lease object via the API server.
  2. The first replica to successfully update the lease becomes the leader.
  3. The leader periodically renews the lease (typically every 10 seconds) to indicate it is still alive.
  4. If the leader fails or cannot renew the lease within the lease duration (default 15 seconds), the lease expires.
  5. Another standby scheduler can then acquire the expired lease and become the new leader.

Scheduler Failover

When the leader crashes or becomes unresponsive, the following occurs:

  • The lease expires after the defined duration (e.g., 15 seconds).
  • Other scheduler replicas detect the expiration via watch events or polling.
  • One of the standby replicas acquires the lease and becomes the new leader.
  • Scheduling resumes with minimal disruption.

Real-World Considerations

  • Lease Duration: Tuning this value balances failover speed and stability. Shorter durations enable faster failover but increase load on the API server.
  • Multiple Schedulers: In addition to the default scheduler, custom schedulers can be deployed, each with its own leader election if needed.
  • Control Plane HA: The scheduler leader election is just one part of the overall HA strategy, which also covers the API server, controller manager, and etcd.

Conclusion

Kubernetes scheduler high availability is achieved through a simple yet robust leader election mechanism using Lease objects. This design ensures that scheduling continues seamlessly even if the active scheduler fails, making Kubernetes suitable for production-grade workloads.

This article is based on the video "Kubernetes Scheduler HA Architecture Explained | Leader Election & Lease Lock Object Deep Dive" by Technical Cloud Knowledge.

React