kube-prometheus icon indicating copy to clipboard operation
kube-prometheus copied to clipboard

Add support for persistentVolumeClaimRetentionPolicy on StatefulSets

Open joebg10 opened this issue 1 year ago • 3 comments

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.

joebg10 avatar Sep 08 '23 22:09 joebg10

Unfortunately the upstream prometheus-operator does not support this field

API Document:

  • https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.PrometheusSpec

Reference source code:

  • https://github.com/prometheus-operator/prometheus-operator/blob/d86d6a449f716137acdbc6d0a2fbce4a7649bda3/pkg/apis/monitoring/v1/prometheus_types.go#L61-L600

AliDev0ps avatar Sep 18 '23 03:09 AliDev0ps

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

simonpasquier avatar Sep 18 '23 12:09 simonpasquier

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

ArthurSens avatar Nov 14 '23 13:11 ArthurSens