1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/monitoring-resizing-a-persistent-volume.adoc

146 lines
4.7 KiB
Plaintext

// Module included in the following assemblies:
//
// * observability/monitoring/configuring-the-monitoring-stack.adoc
:_mod-docs-content-type: PROCEDURE
[id="resizing-a-persistent-volume_{context}"]
= Resizing a persistent volume
You can resize a persistent volume (PV) for monitoring components, such as Prometheus, Thanos Ruler, or Alertmanager. You need to manually expand a persistent volume claim (PVC), and then update the config map in which the component is configured.
[IMPORTANT]
====
You can only expand the size of the PVC. Shrinking the storage size is not possible.
====
.Prerequisites
* You have installed the OpenShift CLI (`oc`).
* *If you are configuring core {product-title} monitoring components*:
** You have access to the cluster as a user with the `cluster-admin` cluster role.
** You have created the `cluster-monitoring-config` `ConfigMap` object.
** You have configured at least one PVC for core {product-title} monitoring components.
* *If you are configuring components that monitor user-defined projects*:
** You have access to the cluster as a user with the `cluster-admin` cluster role, or as a user with the `user-workload-monitoring-config-edit` role in the `openshift-user-workload-monitoring` project.
** A cluster administrator has enabled monitoring for user-defined projects.
** You have configured at least one PVC for components that monitor user-defined projects.
.Procedure
. Manually expand a PVC with the updated storage request. For more information, see "Expanding persistent volume claims (PVCs) with a file system" in _Expanding persistent volumes_.
. Edit the `ConfigMap` object:
** *If you are configuring core {product-title} monitoring components*:
.. Edit the `cluster-monitoring-config` `ConfigMap` object in the `openshift-monitoring` project:
+
[source,terminal]
----
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config
----
.. Add a new storage size for the PVC configuration for the component under `data/config.yaml`:
+
[source,yaml]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-monitoring-config
namespace: openshift-monitoring
data:
config.yaml: |
<component>: #<1>
volumeClaimTemplate:
spec:
resources:
requests:
storage: <amount_of_storage> #<2>
----
<1> The component for which you want to change the storage size.
<2> Specify the new size for the storage volume. It must be greater than the previous value.
+
The following example sets the new PVC request to 100 gigabytes for the Prometheus instance that monitors core {product-title} components:
+
[source,yaml]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-monitoring-config
namespace: openshift-monitoring
data:
config.yaml: |
prometheusK8s:
volumeClaimTemplate:
spec:
resources:
requests:
storage: 100Gi
----
** *If you are configuring components that monitor user-defined projects*:
+
[NOTE]
====
You can resize the volumes for the Thanos Ruler and for instances of Alertmanager and Prometheus that monitor user-defined projects.
====
+
.. Edit the `user-workload-monitoring-config` `ConfigMap` object in the `openshift-user-workload-monitoring` project:
+
[source,terminal]
----
$ oc -n openshift-user-workload-monitoring edit configmap user-workload-monitoring-config
----
.. Update the PVC configuration for the monitoring component under `data/config.yaml`:
+
[source,yaml]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: user-workload-monitoring-config
namespace: openshift-user-workload-monitoring
data:
config.yaml: |
<component>: #<1>
volumeClaimTemplate:
spec:
resources:
requests:
storage: <amount_of_storage> #<2>
----
<1> The component for which you want to change the storage size.
<2> Specify the new size for the storage volume. It must be greater than the previous value.
+
The following example sets the new PVC request to 20 gigabytes for Thanos Ruler:
+
[source,yaml]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: user-workload-monitoring-config
namespace: openshift-user-workload-monitoring
data:
config.yaml: |
thanosRuler:
volumeClaimTemplate:
spec:
resources:
requests:
storage: 20Gi
----
+
[NOTE]
====
Storage requirements for the `thanosRuler` component depend on the number of rules that are evaluated and how many samples each rule generates.
====
. Save the file to apply the changes. The pods affected by the new configuration are automatically redeployed.
+
[WARNING]
====
When you update the config map with a new storage size, the affected `StatefulSet` object is recreated, resulting in a temporary service outage.
====