Skip to content

kube_pod_container_status_restarts_total doesn't return 0 by default #2666

@trip-pguedes

Description

@trip-pguedes

What happened: kube_pod_container_status_restarts_total metric only returns a value when restart happens, returning null while pod has 0 restarts

What you expected to happen: kube_pod_container_status_restarts_total metric returns 0 restarts while a pod has not restarted ever, and then returns the number of restarts if restarts happen

How to reproduce it (as minimally and precisely as possible):

  • Query prometheus metrics in prometheus itself

Shows as such:

Image

Expected to show as such:

Image

Anything else we need to know?:

Environment:

  • kube-state-metrics version:v2.14.0 (using kube-prometheus-stack)
  • Kubernetes version (use kubectl version): 1.30 (EKS)
  • Cloud provider or hardware configuration: Amazon
  • Other info: prometheus:v2.55.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions