Skip to content

When an Ingress resource is deleted, its corresponding metrics remain in Prometheus and are not cleaned up automatically.

Environment: Kubernetes version: 1.24.17 nginx-ingress version: v1.12.1

Problem When an Ingress resource is deleted, its corresponding metrics remain in Prometheus and are not cleaned up automatically. These stale metrics only disappear after restarting the nginx-ingress controller.

Question Is there a way to ensure that these metrics are no longer exposed to Prometheus without restarting nginx-ingress? Are there any configuration options in nginx-ingress to optimize this behavior? Or, is there a better recommended approach for handling stale Ingress metrics?

Image

The Ingress corresponding to sit-prometest22.sss.cn in the picture has already been deleted, but Prometheus is still scraping metrics related to it.