Skip to content

Commit ab562f7

Browse files
authored
Merge pull request #2840 from rexagod/release-2.18
chore: Cut v2.18.0
2 parents 6930ab2 + 3ac7724 commit ab562f7

45 files changed

Lines changed: 577 additions & 141 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ env:
2020
E2E_SETUP_KIND: yes
2121
E2E_SETUP_KUBECTL: yes
2222
SUDO: sudo
23-
GO_VERSION: "^1.24"
24-
GOLANGCI_LINT_VERSION: "v2.4.0"
23+
GO_VERSION: "1.25.6"
24+
GOLANGCI_LINT_VERSION: "v2.8.0"
2525

2626
jobs:
2727
ci-go-lint:

.github/workflows/pre-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout (full history)
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818
with:
1919
fetch-depth: 0
2020
- name: Extract versions
@@ -31,7 +31,7 @@ jobs:
3131
echo "📦 Go version: ${GO_VERSION}"
3232
echo "📦 k8s.io/client-go version: ${CLIENT_GO_VERSION}"
3333
- name: Set up Go
34-
uses: actions/setup-go@v5
34+
uses: actions/setup-go@v6
3535
with:
3636
go-version: ${{ steps.versions.outputs.go-version }}
3737
id: go

.markdownlint-cli2.jsonc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"globs": [
33
"**/*.md"
44
],
5+
"ignores": [
6+
"vendor/**"
7+
],
58
// ToDo: Following rules can't be fixed automatically. They should be enabled when fixed.
69
"config": {
710
"MD004": {
@@ -14,6 +17,7 @@
1417
"summary",
1518
"br"
1619
]
17-
}
20+
},
21+
"MD060": false // Allow table column misalignments
1822
}
1923
}

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3+
## v2.18.0 / 2026-01-11
4+
5+
NOTE: This release addresses a regression that caused a panic when new versions were added to existing `CustomResourceDefinition`s. See the post-mortem analysis in <https://github.com/kubernetes/kube-state-metrics/pull/2838> for more details.
6+
NOTE: `endpointslices` are now part of the default resources exposed as metrics. `endpoints` is deprecated and needs to be manually activated through the `--resources` flag. See <https://github.com/kubernetes/kube-state-metrics/pull/2659> for more details.
7+
8+
* This release builds with Go `v1.25.6`
9+
* This release builds with `k8s.io/client-go`: `v0.34.3`
10+
11+
* [CHANGE] Replace endpoints with endpointslices as default resource by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2659>
12+
* [BUGFIX] Fix regression: React on WATCH updates for CRD informer by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2838>
13+
* [BUGFIX] Deduplicate tolerations when generating `kube_pod_tolerations` by @bhope in <https://github.com/kubernetes/kube-state-metrics/pull/2835>
14+
* [FEATURE] Allow filtering resources via URL parameters by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2844>
15+
* [FEATURE] Add `kube_job_status_ready` metric by @nmn3m in <https://github.com/kubernetes/kube-state-metrics/pull/2771>
16+
* [FEATURE] Add `kube_deployment_owner` metric by @nmn3m in <https://github.com/kubernetes/kube-state-metrics/pull/2782>
17+
* [FEATURE] Add `kube_deployment_status_replicas_terminating` and `kube_replicaset_status_terminating_replicas` metrics by @atiratree in <https://github.com/kubernetes/kube-state-metrics/pull/2708>
18+
* [FEATURE] Promote CronJob, HPA, and Pod metrics from BETA to STABLE by @nmn3m in <https://github.com/kubernetes/kube-state-metrics/pull/2798>
19+
* [FEATURE] Promote StatefulSet metrics to STABLE by @yasicar in <https://github.com/kubernetes/kube-state-metrics/pull/2783>
20+
* [FEATURE] Add info metric for client-go version by @fpetkovski in <https://github.com/kubernetes/kube-state-metrics/pull/2739>
21+
* [FEATURE] Warn on probe failing by @mickael-carl in <https://github.com/kubernetes/kube-state-metrics/pull/2808>
22+
* [ENHANCEMENT] Add `failed` condition to `kube_certificatesigningrequest_condition` by @ksmiley in <https://github.com/kubernetes/kube-state-metrics/pull/2841>
23+
* [ENHANCEMENT] Reduce allocations when creating metric families by @fpetkovski in <https://github.com/kubernetes/kube-state-metrics/pull/2807>
24+
* [ENHANCEMENT] Bump to kubernetes 1.34 by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2785>
25+
* [ENHANCEMENT] Bump exporter-toolkit by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2770>
26+
* [ENHANCEMENT] Replace gojsontoyaml with gojq by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2660>
27+
* [ENHANCEMENT] Split benchmarks by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2759>
28+
329
## v2.17.0 / 2025-09-01
430

531
* This release builds with Go `v1.24.6`

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
1313
OS ?= $(shell uname -s | tr A-Z a-z)
1414
ALL_ARCH = amd64 arm arm64 ppc64le s390x
1515
PKG = github.com/prometheus/common
16-
PROMETHEUS_VERSION = 3.5.0
17-
GO_VERSION = 1.24.6
16+
PROMETHEUS_VERSION = 3.9.1
17+
GO_VERSION = 1.25.5
1818
IMAGE = $(REGISTRY)/kube-state-metrics
1919
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
2020
USER ?= $(shell id -u -n)
2121
HOST ?= $(shell hostname)
22-
MARKDOWNLINT_CLI2_VERSION = 0.18.1
22+
MARKDOWNLINT_CLI2_VERSION = 0.20.0
2323
CLIENT_GO_VERSION = $(shell go list -m -f '{{.Version}}' k8s.io/client-go)
2424
KSM_MODULE = $(shell go list -m)
2525

README.md

Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ are deleted they are no longer visible on the `/metrics` endpoint.
4444
* [ECMAScript regular expression support for allow and deny lists](#ecmascript-regular-expression-support-for-allow-and-deny-lists)
4545
* [Conflict resolution in label names](#conflict-resolution-in-label-names)
4646
* [Kube-state-metrics self metrics](#kube-state-metrics-self-metrics)
47-
* [Resource recommendation](#resource-recommendation)
48-
* [Latency](#latency)
49-
* [A note on costing](#a-note-on-costing)
5047
* [kube-state-metrics vs. metrics-server](#kube-state-metrics-vs-metrics-server)
5148
* [Scaling kube-state-metrics](#scaling-kube-state-metrics)
5249
* [Resource recommendation](#resource-recommendation)
50+
* [Latency](#latency)
51+
* [A note on costing](#a-note-on-costing)
5352
* [Horizontal sharding](#horizontal-sharding)
5453
* [Automated sharding](#automated-sharding)
5554
* [Daemonset sharding for pod metrics](#daemonset-sharding-for-pod-metrics)
55+
* [Resource filtering](#resource-filtering)
5656
* [Setup](#setup)
5757
* [Building the Docker container](#building-the-docker-container)
5858
* [Usage](#usage)
@@ -79,11 +79,11 @@ Generally, it is recommended to use the latest release of kube-state-metrics. If
7979

8080
| kube-state-metrics | Kubernetes client-go Version |
8181
|--------------------|:----------------------------:|
82-
| **v2.13.0** | v1.30 |
8382
| **v2.14.0** | v1.31 |
8483
| **v2.15.0** | v1.32 |
8584
| **v2.16.0** | v1.32 |
8685
| **v2.17.0** | v1.33 |
86+
| **v2.18.0** | v1.34 |
8787
| **main** | v1.34 |
8888

8989
#### Resource group version compatibility
@@ -96,8 +96,8 @@ release.
9696

9797
The latest container image can be found at:
9898

99-
* `registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.17.0` (arch: `amd64`, `arm`, `arm64`, `ppc64le` and `s390x`)
100-
* [Multi-architecture images](https://explore.ggcr.dev/?image=registry.k8s.io%2Fkube-state-metrics%2Fkube-state-metrics:v2.17.0)
99+
* `registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.18.0` (arch: `amd64`, `arm`, `arm64`, `ppc64le` and `s390x`)
100+
* [Multi-architecture images](https://explore.ggcr.dev/?image=registry.k8s.io%2Fkube-state-metrics%2Fkube-state-metrics:v2.18.0)
101101

102102
### Metrics Documentation
103103

@@ -184,6 +184,29 @@ kube_state_metrics_last_config_reload_successful{filename="crs.yml",type="custom
184184
kube_state_metrics_last_config_reload_successful{filename="config.yml",type="config"} 1
185185
```
186186

187+
### kube-state-metrics vs. metrics-server
188+
189+
The [metrics-server](https://github.com/kubernetes-incubator/metrics-server)
190+
is a project that has been inspired by
191+
[Heapster](https://github.com/kubernetes-retired/heapster) and is implemented
192+
to serve the goals of core metrics pipelines in [Kubernetes monitoring
193+
architecture](https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md).
194+
It is a cluster level component which periodically scrapes metrics from all
195+
Kubernetes nodes served by Kubelet through Metrics API. The metrics are
196+
aggregated, stored in memory and served in [Metrics API
197+
format](https://git.k8s.io/metrics/pkg/apis/metrics/v1alpha1/types.go). The
198+
metrics-server stores the latest values only and is not responsible for
199+
forwarding metrics to third-party destinations.
200+
201+
kube-state-metrics is focused on generating completely new metrics from
202+
Kubernetes' object state (e.g. metrics based on deployments, replica sets,
203+
etc.). It holds an entire snapshot of Kubernetes state in memory and
204+
continuously generates new metrics based off of it. And just like the
205+
metrics-server it too is not responsible for exporting its metrics anywhere.
206+
207+
Having kube-state-metrics as a separate project also enables access to these
208+
metrics from monitoring systems such as Prometheus.
209+
187210
### Scaling kube-state-metrics
188211

189212
#### Resource recommendation
@@ -198,7 +221,7 @@ As a general rule, you should allocate:
198221

199222
Note that if CPU limits are set too low, kube-state-metrics' internal queues will not be able to be worked off quickly enough, resulting in increased memory consumption as the queue length grows. If you experience problems resulting from high memory allocation or CPU throttling, try increasing the CPU limits.
200223

201-
### Latency
224+
#### Latency
202225

203226
In a 100 node cluster scaling test the latency numbers were as follows:
204227

@@ -208,34 +231,11 @@ In a 100 node cluster scaling test the latency numbers were as follows:
208231
"Perc99": 906666666 ns.
209232
```
210233

211-
### A note on costing
234+
#### A note on costing
212235

213236
By default, kube-state-metrics exposes several metrics for events across your cluster. If you have a large number of frequently-updating resources on your cluster, you may find that a lot of data is ingested into these metrics. This can incur high costs on some cloud providers. Please take a moment to [configure what metrics you'd like to expose](docs/developer/cli-arguments.md), as well as consult the documentation for your Kubernetes environment in order to avoid unexpectedly high costs.
214237

215-
### kube-state-metrics vs. metrics-server
216-
217-
The [metrics-server](https://github.com/kubernetes-incubator/metrics-server)
218-
is a project that has been inspired by
219-
[Heapster](https://github.com/kubernetes-retired/heapster) and is implemented
220-
to serve the goals of core metrics pipelines in [Kubernetes monitoring
221-
architecture](https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md).
222-
It is a cluster level component which periodically scrapes metrics from all
223-
Kubernetes nodes served by Kubelet through Metrics API. The metrics are
224-
aggregated, stored in memory and served in [Metrics API
225-
format](https://git.k8s.io/metrics/pkg/apis/metrics/v1alpha1/types.go). The
226-
metrics-server stores the latest values only and is not responsible for
227-
forwarding metrics to third-party destinations.
228-
229-
kube-state-metrics is focused on generating completely new metrics from
230-
Kubernetes' object state (e.g. metrics based on deployments, replica sets,
231-
etc.). It holds an entire snapshot of Kubernetes state in memory and
232-
continuously generates new metrics based off of it. And just like the
233-
metrics-server it too is not responsible for exporting its metrics anywhere.
234-
235-
Having kube-state-metrics as a separate project also enables access to these
236-
metrics from monitoring systems such as Prometheus.
237-
238-
### Horizontal sharding
238+
#### Horizontal sharding
239239

240240
In order to shard kube-state-metrics horizontally, some automated sharding capabilities have been implemented. It is configured with the following flags:
241241

@@ -276,7 +276,7 @@ spec:
276276
- image: registry.k8s.io/kube-state-metrics/kube-state-metrics:IMAGE_TAG
277277
name: kube-state-metrics
278278
args:
279-
- --resource=pods
279+
- --resources=pods
280280
- --node=$(NODE_NAME)
281281
env:
282282
- name: NODE_NAME
@@ -304,6 +304,23 @@ spec:
304304

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

307+
#### Resource Filtering
308+
309+
The `/metrics` endpoint supports filtering by resource type using the `resources` query parameter. This allows you to scrape only the metrics for specific Kubernetes resources, which can be useful for reducing the amount of data scraped or for creating separate scraping jobs for different resource types.
310+
311+
Example:
312+
`curl 'http://localhost:8080/metrics?resources=pods,secrets'`
313+
314+
Multiple resources can be specified as a comma-separated list, or by providing the `resources` parameter multiple times.
315+
316+
You can also exclude specific resources using the `exclude_resources` query parameter. This is useful if you want to scrape all metrics except for a few specific ones.
317+
318+
Example:
319+
`curl 'http://localhost:8080/metrics?exclude_resources=pods'`
320+
321+
If both `resources` and `exclude_resources` are provided, the `resources` parameter acts as an allowlist, and `exclude_resources` acts as a denylist, filtering out any resources specified in the `exclude_resources` parameter from the allowed resources.
322+
The exclude_resources takes precedence here and you can only filter on resources that are enabled in kube-state-metrics.
323+
307324
### Setup
308325

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

README.md.tpl

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ are deleted they are no longer visible on the `/metrics` endpoint.
4444
* [ECMAScript regular expression support for allow and deny lists](#ecmascript-regular-expression-support-for-allow-and-deny-lists)
4545
* [Conflict resolution in label names](#conflict-resolution-in-label-names)
4646
* [Kube-state-metrics self metrics](#kube-state-metrics-self-metrics)
47-
* [Resource recommendation](#resource-recommendation)
48-
* [Latency](#latency)
49-
* [A note on costing](#a-note-on-costing)
5047
* [kube-state-metrics vs. metrics-server](#kube-state-metrics-vs-metrics-server)
5148
* [Scaling kube-state-metrics](#scaling-kube-state-metrics)
5249
* [Resource recommendation](#resource-recommendation)
50+
* [Latency](#latency)
51+
* [A note on costing](#a-note-on-costing)
5352
* [Horizontal sharding](#horizontal-sharding)
5453
* [Automated sharding](#automated-sharding)
5554
* [Daemonset sharding for pod metrics](#daemonset-sharding-for-pod-metrics)
55+
* [Resource filtering](#resource-filtering)
5656
* [Setup](#setup)
5757
* [Building the Docker container](#building-the-docker-container)
5858
* [Usage](#usage)
@@ -185,6 +185,29 @@ kube_state_metrics_last_config_reload_successful{filename="crs.yml",type="custom
185185
kube_state_metrics_last_config_reload_successful{filename="config.yml",type="config"} 1
186186
```
187187

188+
### kube-state-metrics vs. metrics-server
189+
190+
The [metrics-server](https://github.com/kubernetes-incubator/metrics-server)
191+
is a project that has been inspired by
192+
[Heapster](https://github.com/kubernetes-retired/heapster) and is implemented
193+
to serve the goals of core metrics pipelines in [Kubernetes monitoring
194+
architecture](https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md).
195+
It is a cluster level component which periodically scrapes metrics from all
196+
Kubernetes nodes served by Kubelet through Metrics API. The metrics are
197+
aggregated, stored in memory and served in [Metrics API
198+
format](https://git.k8s.io/metrics/pkg/apis/metrics/v1alpha1/types.go). The
199+
metrics-server stores the latest values only and is not responsible for
200+
forwarding metrics to third-party destinations.
201+
202+
kube-state-metrics is focused on generating completely new metrics from
203+
Kubernetes' object state (e.g. metrics based on deployments, replica sets,
204+
etc.). It holds an entire snapshot of Kubernetes state in memory and
205+
continuously generates new metrics based off of it. And just like the
206+
metrics-server it too is not responsible for exporting its metrics anywhere.
207+
208+
Having kube-state-metrics as a separate project also enables access to these
209+
metrics from monitoring systems such as Prometheus.
210+
188211
### Scaling kube-state-metrics
189212

190213
#### Resource recommendation
@@ -199,7 +222,7 @@ As a general rule, you should allocate:
199222

200223
Note that if CPU limits are set too low, kube-state-metrics' internal queues will not be able to be worked off quickly enough, resulting in increased memory consumption as the queue length grows. If you experience problems resulting from high memory allocation or CPU throttling, try increasing the CPU limits.
201224

202-
### Latency
225+
#### Latency
203226

204227
In a 100 node cluster scaling test the latency numbers were as follows:
205228

@@ -209,34 +232,11 @@ In a 100 node cluster scaling test the latency numbers were as follows:
209232
"Perc99": 906666666 ns.
210233
```
211234

212-
### A note on costing
235+
#### A note on costing
213236

214237
By default, kube-state-metrics exposes several metrics for events across your cluster. If you have a large number of frequently-updating resources on your cluster, you may find that a lot of data is ingested into these metrics. This can incur high costs on some cloud providers. Please take a moment to [configure what metrics you'd like to expose](docs/developer/cli-arguments.md), as well as consult the documentation for your Kubernetes environment in order to avoid unexpectedly high costs.
215238

216-
### kube-state-metrics vs. metrics-server
217-
218-
The [metrics-server](https://github.com/kubernetes-incubator/metrics-server)
219-
is a project that has been inspired by
220-
[Heapster](https://github.com/kubernetes-retired/heapster) and is implemented
221-
to serve the goals of core metrics pipelines in [Kubernetes monitoring
222-
architecture](https://github.com/kubernetes/design-proposals-archive/blob/main/instrumentation/monitoring_architecture.md).
223-
It is a cluster level component which periodically scrapes metrics from all
224-
Kubernetes nodes served by Kubelet through Metrics API. The metrics are
225-
aggregated, stored in memory and served in [Metrics API
226-
format](https://git.k8s.io/metrics/pkg/apis/metrics/v1alpha1/types.go). The
227-
metrics-server stores the latest values only and is not responsible for
228-
forwarding metrics to third-party destinations.
229-
230-
kube-state-metrics is focused on generating completely new metrics from
231-
Kubernetes' object state (e.g. metrics based on deployments, replica sets,
232-
etc.). It holds an entire snapshot of Kubernetes state in memory and
233-
continuously generates new metrics based off of it. And just like the
234-
metrics-server it too is not responsible for exporting its metrics anywhere.
235-
236-
Having kube-state-metrics as a separate project also enables access to these
237-
metrics from monitoring systems such as Prometheus.
238-
239-
### Horizontal sharding
239+
#### Horizontal sharding
240240

241241
In order to shard kube-state-metrics horizontally, some automated sharding capabilities have been implemented. It is configured with the following flags:
242242

@@ -277,7 +277,7 @@ spec:
277277
- image: registry.k8s.io/kube-state-metrics/kube-state-metrics:IMAGE_TAG
278278
name: kube-state-metrics
279279
args:
280-
- --resource=pods
280+
- --resources=pods
281281
- --node=$(NODE_NAME)
282282
env:
283283
- name: NODE_NAME
@@ -305,6 +305,23 @@ spec:
305305

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

308+
#### Resource Filtering
309+
310+
The `/metrics` endpoint supports filtering by resource type using the `resources` query parameter. This allows you to scrape only the metrics for specific Kubernetes resources, which can be useful for reducing the amount of data scraped or for creating separate scraping jobs for different resource types.
311+
312+
Example:
313+
`curl 'http://localhost:8080/metrics?resources=pods,secrets'`
314+
315+
Multiple resources can be specified as a comma-separated list, or by providing the `resources` parameter multiple times.
316+
317+
You can also exclude specific resources using the `exclude_resources` query parameter. This is useful if you want to scrape all metrics except for a few specific ones.
318+
319+
Example:
320+
`curl 'http://localhost:8080/metrics?exclude_resources=pods'`
321+
322+
If both `resources` and `exclude_resources` are provided, the `resources` parameter acts as an allowlist, and `exclude_resources` acts as a denylist, filtering out any resources specified in the `exclude_resources` parameter from the allowed resources.
323+
The exclude_resources takes precedence here and you can only filter on resources that are enabled in kube-state-metrics.
324+
308325
### Setup
309326

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

0 commit comments

Comments
 (0)