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.
  • Ensure that you are aware of the best practices for configuring persistent storage by reading the product documentation on the Prometheus website.

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 file ibm-guardium-insights/inventory/prometheusSetup/files/prometheus.yaml.
      Example:
      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 configmap: cluster-monitoring-config.
    Example:
    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