5.4. Persistent storage using Logical Volume Manager Storage
Logical Volume Manager (LVM) Storage uses LVM2 through the TopoLVM CSI driver to dynamically provision local storage on a cluster with limited resources.
You can create volume groups, persistent volume claims (PVCs), volume snapshots, and volume clones by using LVM Storage.
5.4.1. Logical Volume Manager Storage installation 复制链接链接已复制到粘贴板!
You can install Logical Volume Manager (LVM) Storage on an OpenShift Container Platform cluster and configure it to dynamically provision storage for your workloads.
You can install LVM Storage by using the OpenShift Container Platform CLI (oc), OpenShift Container Platform web console, or Red Hat Advanced Cluster Management (RHACM).
When using LVM Storage on multi-node clusters, LVM Storage only supports provisioning local storage. LVM Storage does not support storage data replication mechanisms across nodes. You must ensure storage data replication through active or passive replication mechanisms to avoid a single point of failure.
5.4.1.1. Prerequisites to install LVM Storage 复制链接链接已复制到粘贴板!
The prerequisites to install LVM Storage are as follows:
- Ensure that you have a minimum of 10 milliCPU and 100 MiB of RAM.
- Ensure that every managed cluster has dedicated disks that are used to provision storage. LVM Storage uses only those disks that are empty and do not contain file system signatures. To ensure that the disks are empty and do not contain file system signatures, wipe the disks before using them.
Before installing LVM Storage in a private CI environment where you can reuse the storage devices that you configured in the previous LVM Storage installation, ensure that you have wiped the disks that are not in use. If you do not wipe the disks before installing LVM Storage, you cannot reuse the disks without manual intervention.
注意You cannot wipe the disks that are in use.
- If you want to install LVM Storage by using Red Hat Advanced Cluster Management (RHACM), ensure that you have installed RHACM on an OpenShift Container Platform cluster. See the "Installing LVM Storage using RHACM" section.
5.4.1.2. Installing LVM Storage by using the CLI 复制链接链接已复制到粘贴板!
As a cluster administrator, you can install LVM Storage by using the OpenShift CLI.
The default namespace for the LVM Storage Operator is openshift-lvm-storage.
Prerequisites
-
You have installed the OpenShift CLI (
oc). -
You have logged in to OpenShift Container Platform as a user with
cluster-adminand Operator installation permissions.
Procedure
Create a YAML file with the configuration for creating a namespace:
Example YAML configuration for creating a namespace
apiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" pod-security.kubernetes.io/enforce: privileged pod-security.kubernetes.io/audit: privileged pod-security.kubernetes.io/warn: privileged name: openshift-lvm-storageCreate the namespace by running the following command:
$ oc create -f <file_name>Create an
OperatorGroupCR YAML file:Example
OperatorGroupCRapiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: openshift-storage-operatorgroup namespace: openshift-lvm-storage spec: targetNamespaces: - openshift-storageCreate the
OperatorGroupCR by running the following command:$ oc create -f <file_name>Create a
SubscriptionCR YAML file:Example
SubscriptionCRapiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: lvms namespace: openshift-lvm-storage spec: installPlanApproval: Automatic name: lvms-operator source: redhat-operators sourceNamespace: openshift-marketplaceCreate the
SubscriptionCR by running the following command:$ oc create -f <file_name>
Verification
To verify that LVM Storage is installed, run the following command:
$ oc get csv -n openshift-lvm-storage -o custom-columns=Name:.metadata.name,Phase:.status.phaseExample output
Name Phase 4.13.0-202301261535 Succeeded
5.4.1.3. Installing LVM Storage by using the web console 复制链接链接已复制到粘贴板!
You can install LVM Storage by using the OpenShift Container Platform web console.
The default namespace for the LVM Storage Operator is openshift-lvm-storage.
Prerequisites
- You have access to the cluster.
-
You have access to OpenShift Container Platform with
cluster-adminand Operator installation permissions.
Procedure
- Log in to the OpenShift Container Platform web console.
-
Click Ecosystem
Software Catalog. - Click LVM Storage on the software catalog page.
Set the following options on the Operator Installation page:
- Update Channel as stable-4.21.
- Installation Mode as A specific namespace on the cluster.
-
Installed Namespace as Operator recommended namespace openshift-storage. If the
openshift-lvm-storagenamespace does not exist, it is created during the operator installation. Update approval as Automatic or Manual.
注意If you select Automatic updates, the Operator Lifecycle Manager (OLM) automatically updates the running instance of LVM Storage without any intervention.
If you select Manual updates, the OLM creates an update request. As a cluster administrator, you must manually approve the update request to update LVM Storage to a newer version.
- Optional: Select the Enable Operator recommended cluster monitoring on this Namespace checkbox.
- Click Install.
Verification steps
- Verify that LVM Storage shows a green tick, indicating successful installation.
You can install LVM Storage on OpenShift Container Platform in a disconnected environment. All sections referenced in this procedure are linked in the "Additional resources" section.
Prerequisites
- You read the "About disconnected installation mirroring" section.
- You have access to the OpenShift Container Platform image repository.
- You created a mirror registry.
Procedure
Follow the steps in the "Creating the image set configuration" procedure. To create an
ImageSetConfigurationcustom resource (CR) for LVM Storage, you can use the following exampleImageSetConfigurationCR configuration:Example
ImageSetConfigurationCR for LVM Storagekind: ImageSetConfiguration apiVersion: mirror.openshift.io/v1alpha2 archiveSize: 41 storageConfig:2 registry: imageURL: example.com/mirror/oc-mirror-metadata3 skipTLS: false mirror: platform: channels: - name: stable-4.214 type: ocp graph: true5 operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.216 packages: - name: lvms-operator7 channels: - name: stable8 additionalImages: - name: registry.redhat.io/ubi9/ubi:latest9 helm: {}- 1
- Set the maximum size (in GiB) of each file within the image set.
- 2
- Specify the location in which you want to save the image set. This location can be a registry or a local directory. You must configure the
storageConfigfield unless you are using the Technology Preview OCI feature. - 3
- Specify the storage URL for the image stream when using a registry. For more information, see Why use imagestreams.
- 4
- Specify the channel from which you want to retrieve the OpenShift Container Platform images.
- 5
- Set this field to
trueto generate the OpenShift Update Service (OSUS) graph image. For more information, see About the OpenShift Update Service. - 6
- Specify the Operator catalog from which you want to retrieve the OpenShift Container Platform images.
- 7
- Specify the Operator packages to include in the image set. If this field is empty, all packages in the catalog are retrieved.
- 8
- Specify the channels of the Operator packages to include in the image set. You must include the default channel for the Operator package even if you do not use the bundles in that channel. You can find the default channel by running the following command:
$ oc mirror list operators --catalog=<catalog_name> --package=<package_name>. - 9
- Specify any additional images to include in the image set.
- Follow the procedure in the "Mirroring an image set to a mirror registry" section.
- Follow the procedure in the "Configuring image registry repository mirroring" section.
5.4.1.5. Installing LVM Storage by using RHACM 复制链接链接已复制到粘贴板!
To install LVM Storage on the clusters by using Red Hat Advanced Cluster Management (RHACM), you must create a Policy custom resource (CR). You can also configure the criteria to select the clusters on which you want to install LVM Storage.
The Policy CR that is created to install LVM Storage is also applied to the clusters that are imported or created after creating the Policy CR.
Prerequisites
-
You have access to the RHACM cluster using an account with
cluster-adminand Operator installation permissions. - You have dedicated disks that LVM Storage can use on each cluster.
- The cluster must be managed by RHACM.
Procedure
- Log in to the RHACM CLI using your OpenShift Container Platform credentials.
Create a namespace.
$ oc create ns <namespace>Create a
PolicyCR YAML file:Example
PolicyCR to install and configure LVM StorageapiVersion: apps.open-cluster-management.io/v1 kind: PlacementRule metadata: name: placement-install-lvms spec: clusterConditions: - status: "True" type: ManagedClusterConditionAvailable clusterSelector:1 matchExpressions: - key: mykey operator: In values: - myvalue --- apiVersion: policy.open-cluster-management.io/v1 kind: PlacementBinding metadata: name: binding-install-lvms placementRef: apiGroup: apps.open-cluster-management.io kind: PlacementRule name: placement-install-lvms subjects: - apiGroup: policy.open-cluster-management.io kind: Policy name: install-lvms --- apiVersion: policy.open-cluster-management.io/v1 kind: Policy metadata: annotations: policy.open-cluster-management.io/categories: CM Configuration Management policy.open-cluster-management.io/controls: CM-2 Baseline Configuration policy.open-cluster-management.io/standards: NIST SP 800-53 name: install-lvms spec: disabled: false remediationAction: enforce policy-templates: - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: install-lvms spec: object-templates: - complianceType: musthave objectDefinition:2 apiVersion: v1 kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" pod-security.kubernetes.io/enforce: privileged pod-security.kubernetes.io/audit: privileged pod-security.kubernetes.io/warn: privileged name: openshift-lvm-storage - complianceType: musthave objectDefinition:3 apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: openshift-storage-operatorgroup namespace: openshift-lvm-storage spec: targetNamespaces: - openshift-lvm-storage - complianceType: musthave objectDefinition:4 apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: lvms namespace: openshift-lvm-storage spec: installPlanApproval: Automatic name: lvms-operator source: redhat-operators sourceNamespace: openshift-marketplace remediationAction: enforce severity: lowCreate the
PolicyCR by running the following command:$ oc create -f <file_name> -n <namespace>Upon creating the
PolicyCR, the following custom resources are created on the clusters that match the selection criteria configured in thePlacementRuleCR:-
Namespace -
OperatorGroup -
Subscription
-
The default namespace for the LVM Storage Operator is openshift-lvm-storage.