# Using OpenEBS for your Prometheus data

**URL:** https://discuss.kubernetes.io/t/using-openebs-for-your-prometheus-data/15826
**Category:** microk8s
**Tags:** docs
**Created:** [May 8, 2021, 2:11am UTC](https://discuss.kubernetes.io/t/using-openebs-for-your-prometheus-data/15826 "2021-05-08T02:11:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![balchua1](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/balchua1/32/5372_2.png) [@balchua1](https://discuss.kubernetes.io/u/balchua1)
#### Post date: [May 8, 2021, 2:11am UTC](https://discuss.kubernetes.io/t/using-openebs-for-your-prometheus-data/15826/1 "2021-05-08T02:11:27Z")

</div>

With the inclusion of OpenEBS addon, one can now use OpenEBS to serve your Prometheus’ persistent volume.

This has the advantage of keeping your Prometheus data in place when one of the node goes down.

In the steps below, we will be using jiva `StorageClass` for simplicity

After installing MicroK8s:

1. Enable OpenEBS,

```auto
$ microk8s enable openebs

```

1. Set the `openebs-jiva-default` `StorageClass` as your default.

```auto
$ kubectl patch storageclass open-jiva-default -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

```

1. Enable the prometheus addon

```auto
$ microk8s enable prometheus

```

1. Next we are going to patch the `Prometheus` CR to use the `openebs-jiva-default` storage class.
2. Create a file, ex: `/tmp/patch-prometheus.yaml`

```auto

spec:
  storage:
    volumeClaimTemplate:
      spec:
        storageClassName: openebs-jiva-default
        resources:
          requests:
            storage: 5Gi

```

1. Apply the patch using `merge`, because strategic patch does not work with CRDs.

```auto
kubectl -n monitoring patch prometheus k8s --patch "$(cat /tmp/patch-prometheus.yaml)" --type=merge

```

You should start seeing the pod `prometheus-k8s-0` restarting and Persistent Volume Claim using the openebs-jiva-default storage class.

```auto
 kubectl get pvc -n monitoring
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
prometheus-k8s-db-prometheus-k8s-0 Bound pvc-a8923b60-bd4c-4fe0-b5a9-aa0c74d2939d 5Gi RWO openebs-jiva-default 13m

```

Now if one of your nodes goes down, prometheus can be started on a different node while retaining its data.
