diff --git a/docs/sources/installation/helm/reference.md b/docs/sources/installation/helm/reference.md
index de3d88759f..73eb9dbd4d 100644
--- a/docs/sources/installation/helm/reference.md
+++ b/docs/sources/installation/helm/reference.md
@@ -2484,6 +2484,15 @@ null
{}
+ |
+
+
+ read.persistence.enableStatefulSetAutoDeletePVC |
+ bool |
+ Enable StatefulSetAutoDeletePVC feature |
+
+true
+
|
diff --git a/production/helm/loki/templates/read/statefulset-read.yaml b/production/helm/loki/templates/read/statefulset-read.yaml
index e9d77199a7..13f0bea209 100644
--- a/production/helm/loki/templates/read/statefulset-read.yaml
+++ b/production/helm/loki/templates/read/statefulset-read.yaml
@@ -16,7 +16,7 @@ spec:
partition: 0
serviceName: {{ printf "%s-headless" (include "loki.readFullname" .) }}
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
- {{- if (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) }}
+ {{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.read.persistence.enableStatefulSetAutoDeletePVC) }}
{{/*
Data on the read nodes is easy to replace, so we want to always delete PVCs to make
operation easier, and will rely on re-fetching data when needed.
diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml
index e99db2907f..e371d36e82 100644
--- a/production/helm/loki/values.yaml
+++ b/production/helm/loki/values.yaml
@@ -852,6 +852,8 @@ read:
# -- Tolerations for read pods
tolerations: []
persistence:
+ # -- Enable StatefulSetAutoDeletePVC feature
+ enableStatefulSetAutoDeletePVC: true
# -- Size of persistent disk
size: 10Gi
# -- Storage class to be used.