prometheus-community / helm-charts

Prometheus community Helm charts
Apache License 2.0
5.11k stars 5.02k forks source link

[kube-prometheus-stack] way to use hostpath as /prometheus storage #4416

Open yjagdale opened 7 months ago

yjagdale commented 7 months ago

Describe the bug a clear and concise description of what the bug is.

Hello,

I am trying to mount /prometheus to hostpath (/storage) to use as persistent volume in my onprem cluster.

Issue is when I set persistence as of, /Prometheus is being mounted to empty directory which doesn't allow me to mount by using volumes and volume mounts way.

What's your helm version?

version.BuildInfo{Version:"v3.14.3", GitCommit:"f03cc04caaa8f6d7c3e67cf918929150cf6f3f12", GitTreeState:"clean", GoVersion:"go1.22.1"}

What's your kubectl version?

Client Version: v1.29.1 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.27.12+rke2r1 WARNING: version difference between client (1.29) and server (1.27) exceeds the supported minor version skew of +/-1

Which chart?

kube-prometheus-stack

What's the chart version?

57.2.0

What happened?

I set persistence as of, /Prometheus is being mounted to empty directory which doesn't allow me to mount by using volumes and volume mounts way.

What you expected to happen?

should have way to disable empty directory mount.

How to reproduce it?

you can run helm chart with following values to reproduce

        prometheus:
          prometheusSpec:
            volumes:
            - name: prometheus-storage
              hostPath:
                path: /mnt/databahn/prometheus

            volumeMounts:
            - name: prometheus-storage
              mountPath: /prometheus

Enter the changed values of values.yaml?

    prometheus:
      prometheusSpec:
        volumes:
        - name: prometheus-storage
          hostPath:
            path: /mnt/databahn/prometheus

        volumeMounts:
        - name: prometheus-storage
          mountPath: /prometheus

Enter the command that you execute and failing/misfunctioning.

using helmfile to install the chart

Anything else we need to know?

No response

zeritti commented 7 months ago

You should use prometheus.prometheusSpec.storageSpec (values' StorageSpec) for specifying Prometheus' data storage. See also prometheus CRD's StorageSpec. For more information on storage, see storage user guide.