Skip to content

Commit 6dad863

Browse files
committed
Use kube_statefulset_replicas for KubeStatefulSetReplicasMismatch
According to [0] and [1] `kube_statefulset_status_replicas` returns "the number of Pods created by the StatefulSet controller". Therefore this alert only fires when the StatefulSet controller is able to create the pod, but it does not get ready. In cases where the controller is unable to create the pod (e.g. invalid pod spec) this alert does not fire. This is contrary to the expectation of firing when the statefulset does not match the configured amount of replicas. [0]: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#statefulsetstatus-v1-apps [1]: https://github.com/kubernetes/kube-state-metrics/blob/2a95d4649b2fea55799032fb9c0b571c4ba7f776/internal/store/statefulset.go#L75
1 parent 96d585c commit 6dad863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

alerts/apps_alerts.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ local utils = import '../lib/utils.libsonnet';
121121
(
122122
kube_statefulset_status_replicas_ready{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
123123
!=
124-
kube_statefulset_status_replicas{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
124+
kube_statefulset_replicas{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
125125
) and (
126126
changes(kube_statefulset_status_replicas_updated{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}[10m])
127127
==

0 commit comments

Comments
 (0)