Etcd Leader Election Test

In etcd, leader election is a process where nodes (peers) in the cluster elect one node to act as the leader. The leader handles write requests, while followers replicate the leader’s log entries. The Raft consensus algorithm ensures that only one leader exists at any time, preventing split-brain scenarios. If the leader fails or becomes unreachable, the remaining nodes will automatically initiate a new leader election to ensure the cluster can continue accepting writes and maintaining consistency.

Monitoring leader election in etcd is crucial to ensure high availability and consistency. If a leader fails and a new election is triggered, delays in electing a new leader can prevent the cluster from accepting writes. Tracking this process helps detect issues, maintain cluster stability, and avoid service disruptions.

This test monitors the etcd leader election and reveals the leader details. Administrators can analyze the metric over time to get valuable insights into current state and potential issues which can cause connectivity to fail.

Target of the test : A Kubernetes Master Node

Agent deploying the test : A remote agent

Outputs of the test : One set of results for target Kubernetes Master node being monitored.

Configurable parameters for the test

Parameter

Description

Test Period

How often should the test be executed.

Host

The IP address of the host for which this test is to be configured.

Port

Specify the port at which the specified Host listens. By default, this is 6443.

Timeout

Specify the duration (in seconds) beyond which the test will timeout in the Timeout text box. The default value is 10 seconds.

Metric URL

Each of the Kubernetes system components expose monitoring metrics through /metrics endpoint of the HTTP server. For components that don't expose endpoint by default, refer official Kubernetes distribution documentation site. Specify the metric URL textbox.

Measurements made by the test

Measurement

Description

Measurement Unit

Interpretation

Has Leader

Indicates if the current etcd has a leader.

 

The values that this measure reports and their corresponding numeric values are detailed in the table below:

Measure Value Numeric Value
Yes 0
No 1

Note:

By default, this test reports the Measure Values listed in the table above to indicate if etcd has a leader. In the graph of this measure however, the state is indicated using the numeric equivalents only.

Is Leader

Indicates if the current master node is the leader.

 

The values that this measure reports and their corresponding numeric values are detailed in the table below:

Measure Value Numeric Value
Yes 0
No 1

Note:

By default, this test reports the Measure Values listed in the table above to if current etcd node ins a . In the graph of this measure however, the state is indicated using the numeric equivalents only.

Total Leader Changes

Indicates the total number of leader changes in the etcd since start.

Number