Configuring persistent storage

When you configure persistent storage, your metrics are saved on a persistent volume (PV) and are not deleted when a pod is restarted or re-created.

Before you begin

  • Read the documentation for OpenShift® Container Platform Prometheus persistent storage.
  • Read the product documentation on the Prometheus website to learn about the recommended practices for configuring persistent storage.

About this task

Use the following procedure to configure storage.
Important:
  • Replace <storage_class> with your storage class.
  • user-workload-monitoring-config is the retention period for user data on Prometheus storage.
  • For user-defined projects, you must configure the retention period of metrics to be at least 15 days.

Procedure

  1. Add your PVC configuration.
    1. Edit the ibm-guardium-insights/inventory/prometheusSetup/files/prometheus.yaml file.
      Example output:
      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: cluster-monitoring-config
        namespace: openshift-monitoring
      data:
        config.yaml: |
          enableUserWorkload: true
          prometheusK8s:
            externalLabels:
              cluster_name: gi
            volumeClaimTemplate:
              spec:
                storageClassName: <storage_class>
                resources:
                  requests:
                    storage: 50Gi
          alertmanagerMain:
            volumeClaimTemplate:
              spec:
                storageClassName: <storage_class>
                resources:
                  requests:
                    storage: 20Gi
  2. Edit the cluster-monitoring-config configmap.
    Example output:
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: user-workload-monitoring-config
      namespace: openshift-user-workload-monitoring
    data:
      config.yaml: |
        prometheus:
          retention: 15d
          externalLabels:
            cluster_name: gi
          volumeClaimTemplate:
            spec:
              storageClassName: <storage_class>
              resources:
                requests:
                  storage: 50Gi
        thanosRuler:
          volumeClaimTemplate:
            spec:
              storageClassName: <storage_class>
              resources:
                requests:
                  storage: 20Gi
  3. Apply the changes.
    oc apply -f ibm-guardium-insights/inventory/prometheusSetup/files/prometheus.yaml