prometheus-operator / kube-prometheus

Use Prometheus to monitor Kubernetes and applications running on Kubernetes
https://prometheus-operator.dev/
Apache License 2.0
6.67k stars 1.92k forks source link

Add support for persistentVolumeClaimRetentionPolicy on StatefulSets #2216

Open joebg10 opened 1 year ago

joebg10 commented 1 year ago

What is missing? An ability to choose whether k8s deletes or retains PVCs in tandem with the lifecycle of a StatefulSet, due to the new beta field spec.persistentVolumeClaimRetentionPolicy in the latest version of Kubernetes. There is no way to configure the StatefulSet of Prometheus in kube-prometheus.

Why do we need it? Because the new field defaults to Retain, PVCs remain bound to their PVs during cluster deletion while StatefulSets are being removed. This provides surface for a CSI Driver to see a stale, but intact PVC from a pod who no longer is requesting resources during cluster deletion. The CSI Driver then lacks the ability to manage(delete) unbound, available Volumes that otherwise would have been destroyed, resulting in orphaned resources.

AliDev0ps commented 1 year ago

Unfortunately the upstream prometheus-operator does not support this field

API Document:

Reference source code:

simonpasquier commented 1 year ago

https://github.com/prometheus-operator/prometheus-operator/issues/1897 is the corresponding (and blocking) operator issue.

ArthurSens commented 10 months ago

Issue solved upstream, should be good to advance here once new release is out!