Skip to content

docs: High Availability Setup documentation #2715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ are deleted they are no longer visible on the `/metrics` endpoint.
* [Horizontal sharding](#horizontal-sharding)
* [Automated sharding](#automated-sharding)
* [Daemonset sharding for pod metrics](#daemonset-sharding-for-pod-metrics)
* [High Availability](#high-availability)
* [Setup](#setup)
* [Building the Docker container](#building-the-docker-container)
* [Usage](#usage)
Expand Down Expand Up @@ -304,6 +305,12 @@ spec:

Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding).

### High Availability

For high availability, run multiple kube-state-metrics replicas to prevent a single point of failure. A standard setup uses at least 2 replicas, pod anti-affinity rules to ensure they run on different nodes, and a PodDisruptionBudget (PDB) with `minAvailable: 1` to protect against voluntary disruptions.

When scraping the individual pods directly in an HA setup, Prometheus will ingest duplicate metrics distinguished only by the instance label. This requires you to deduplicate the data in your queries, for example, by using `max without(instance) (your_metric)`. The correct aggregation function (max, sum, avg, etc.) is important and depends on the metric type, as using the wrong one can produce incorrect values for timestamps or during brief state transitions.

### Setup

Install this project to your `$GOPATH` using `go get`:
Expand Down
7 changes: 7 additions & 0 deletions README.md.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ are deleted they are no longer visible on the `/metrics` endpoint.
* [Horizontal sharding](#horizontal-sharding)
* [Automated sharding](#automated-sharding)
* [Daemonset sharding for pod metrics](#daemonset-sharding-for-pod-metrics)
* [High Availability](#high-availability)
* [Setup](#setup)
* [Building the Docker container](#building-the-docker-container)
* [Usage](#usage)
Expand Down Expand Up @@ -305,6 +306,12 @@ spec:

Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding).

### High Availability

For high availability, run multiple kube-state-metrics replicas to prevent a single point of failure. A standard setup uses at least 2 replicas, pod anti-affinity rules to ensure they run on different nodes, and a PodDisruptionBudget (PDB) with `minAvailable: 1` to protect against voluntary disruptions.

When scraping the individual pods directly in an HA setup, Prometheus will ingest duplicate metrics distinguished only by the instance label. This requires you to deduplicate the data in your queries, for example, by using `max without(instance) (your_metric)`. The correct aggregation function (max, sum, avg, etc.) is important and depends on the metric type, as using the wrong one can produce incorrect values for timestamps or during brief state transitions.

### Setup

Install this project to your `$GOPATH` using `go get`:
Expand Down