Deploying and managing OpenShift Data Foundation on single node OpenShift clusters
Instructions for deploying and managing OpenShift Data Foundation on single node OpenShift clusters.
Abstract
Making open source more inclusive
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Providing feedback on Red Hat documentation
We appreciate your input on our documentation. Do let us know how we can make it better. To give feedback:
For simple comments on specific passages:
- Make sure you are viewing the documentation in the Multi-page HTML format. In addition, ensure you see the Feedback button in the upper right corner of the document.
- Use your mouse cursor to highlight the part of text that you want to comment on.
- Click the Add Feedback pop-up that appears below the highlighted text.
- Follow the displayed instructions.
For submitting more complex feedback, create a Bugzilla ticket:
- Go to the Bugzilla website.
- In the Component section, choose documentation.
- Fill in the Description field with your suggestion for improvement. Include a link to the relevant part(s) of documentation.
- Click Submit Bug.
Preface
Red Hat OpenShift Data Foundation supports deploying OpenShift Data Foundation using the Red Hat OpenShift Data Foundation Logical Volume Manager Operator on single node OpenShift (SNO) clusters. This operator uses the TopoLVM CSI driver to dynamically provision local storage.
Red Hat OpenShift Data Foundation Logical Volume Manager Operator creates thin-provisioned volumes using the Logical Volume Manager and provides dynamic provisioning of block storage on a single node, limited resources SNO cluster.
You can deploy the Red Hat OpenShift Data Foundation Logical Volume Manager Operator on a single node Openshift bare metal or user provisioned infrasturcture cluster and configure it to dynamically provision storage for your workloads.
The operator creates a volume group using all the available unused disks and creates a single thin pool with a size of 90% of the volume group. The remaining 10% of the volume group is left free to enable data recovery by expanding the thin pool when required. You might need to manually perform such recovery.
You can use persistent volume claims (PVCs) and volume snapshots provisioned by the Logical Volume Manager Operator to request storage and create volume snapshots.
The Red Hat OpenShift Data Foundation Logical Volume Manager Operator configures a default overprovisioning limit of 10 to take advantage of the thin-provisioning feature. The total size of the volumes and volume snapshots that can be created on the single node OpenShift clusters is 10 times the size of the thin pool.
You can deploy OpenShift Data Foundation on single node OpenShift clusters using one of the following:
- Red Hat Advanced Cluster Management for Kubernetes (RHACM)
- OpenShift Web Console
Chapter 1. Deploying OpenShift Data Foundation on single node OpenShift clusters using RHACM
1.1. Requirements for deploying using RHACM
Before you begin deploying OpenShift Data Foundation Logical Volume Manager Operator on single node Openshift clusters, ensure that the following requirements are met:
- You have installed Red Hat Advanced Cluster Management for Kubernetes (RHACM) on an OpenShift cluster. For information, see Red Hat Advanced Cluster Management for Kubernetes: Install.
- Every managed SNO cluster has dedicated disks that are used to provision storage.
1.2. Installing the OpenShift Data Foundation Logical Volume Manager Operator using RHACM
The OpenShift Data Foundation Logical Volume Manager Operator is deployed on single node OpenShift (SNO) clusters using Red Hat Advanced Cluster Management for Kubernetes (RHACM). You create a Policy on RHACM that deploys and configures the operator when it is applied to managed clusters which match the selector specified in the PlacementRule
. The policy is also applied to clusters that are imported later and satisfy the PlacementRule
.
Prerequisites
-
Access to the RHACM cluster using an account with
cluster-admin
and operator installation permissions. - Dedicated disks on each SNO cluster to be used by OpenShift Data Foundation Logical Volume Manager Operator.
Ensure that no other storage provisioner is installed on the SNO cluster. OpenShift Data Foundation Logical Volume Manager Operator should be the only storage provisioner as it uses all available disks on the node.
Procedure
Log in to the RHACM CLI using your OpenShift credentials.
For more information, see Install Red Hat Advanced Cluster Management for Kubernetes.
Create a namespace in which you will create policies.
# oc create ns lvm-policy-ns
Save the following YAML to a file with a name such as
policy-lvm-operator.yaml
to create a policy.# This policy verifies the installation of the official version of the {product-name-short} # Logical Volume Manager Operator on the managed clusters. # If set to "enforce" it installs the operator. # Used APIs: OLM, ODF-LVMO #https://github.com/operator-framework/operator-lifecycle-manager # https://github.com/red-hat-storage/lvm-operator apiVersion: apps.open-cluster-management.io/v1 kind: PlacementRule metadata: name: placement-install-odf-lvm-operator spec: clusterConditions: - status: "True" type: ManagedClusterConditionAvailable clusterSelector: matchExpressions: - key: vendor operator: In values: - OpenShift --- apiVersion: policy.open-cluster-management.io/v1 kind: PlacementBinding metadata: name: binding-install-odf-lvm-operator placementRef: apiGroup: apps.open-cluster-management.io kind: PlacementRule name: placement-install-odf-lvm-operator subjects: - apiGroup: policy.open-cluster-management.io kind: Policy name: install-odf-lvm-operator --- 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-odf-lvm-operator spec: disabled: false remediationAction: enforce policy-templates: - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: install-odf-lvm-operator spec: object-templates: - complianceType: musthave objectDefinition: 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-storage - complianceType: musthave objectDefinition: apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: openshift-storage-operatorgroup namespace: openshift-storage spec: targetNamespaces: - openshift-storage - complianceType: musthave objectDefinition: apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: odf-lvm-operator namespace: openshift-storage spec: installPlanApproval: Automatic name: odf-lvm-operator source: redhat-operators sourceNamespace: openshift-marketplace remediationAction: enforce severity: low - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: odf-lvmcluster spec: object-templates: - complianceType: musthave objectDefinition: apiVersion: lvm.topolvm.io/v1alpha1 kind: LVMCluster metadata: name: odf-lvmcluster namespace: openshift-storage spec: storage: deviceClasses: - name: vg1 thinPoolConfig: name: thin-pool-1 sizePercent: 90 overprovisionRatio: 10 remediationAction: enforce severity: low
Create the policy in the namespace by running the following command:
# oc create -f policy-lvm-operator.yaml -n lvm-policy-ns
where,
policy-lvm-operator.yaml
is the name of the file to which the policy is saved.This creates a
Policy
, aPlacementRule
, and aPlacementBinding
in the namespace,lvm-policy-ns
. ThePolicy
creates aNamespace
,OperatorGroup
,Subscription
, andLVMCluster
resource on the clusters matching the PlacementRule. This deploys the operator on the SNO clusters which match the selection criteria and configures it to set up the required resources to provision storage. The operator uses all the unused disks after installation.
1.3. Uninstalling OpenShift Data Foundation Logical Volume Manager Operator installed using RHACM
To uninstall OpenShift Data Foundation Logical Volume Manager Operator when you have installed the operator using RHACM, you need to delete the ACM policy that you created for deploying and configuring the operator. However, when you delete the ACM policy, the resources that the policy has created are not removed. You need to create additional policies to remove the resources.
As the resources that are created are not removed when you delete the policy, you need to perform the following steps:
- Remove all the PVCs and volume snapshots provisioned by the Logical Volume Manager Operator.
-
Remove the
LVMCluster
resources to clean up the Logical Volume Manager resources created on the disks. - Create an additional policy to uninstall the operator.
Prerequisites
Ensure that the following are deleted before deleting the policy:
- All the applications on the managed clusters that are using the storage provisioned by the OpenShift Data Foundation Logical Volume Manager Operator.
- Persistent volume claims (PVCs) and persistent volumes (PVs) provisioned using the OpenShift Data Foundation Logical Volume Manager Operator.
- All volume snapshots provisioned by the OpenShift Data Foundation Logical Volume Manager Operator.
-
Ensure that no logical volume resources exist by using the
oc get logicalvolume
command. -
Access to the RHACM cluster using an account with
cluster-admin
role.
Procedure
In the OpenShift command-line interface, delete the ACM policy that you created for deploying and configuring the OpenShift Data Foundation Logical Volume Manager Operator on the hub cluster by using the following command:
# oc delete -f policy-lvm-operator.yaml -n lvm-policy-ns
Save the following YAML to a file with a name such as
odf-lvmcluster-deletion.yaml
to create a policy for removing theLVMCluster
. This enables the operator to clean up all the Logical Volume Manager resources that it created on the cluster.apiVersion: policy.open-cluster-management.io/v1 kind: Policy metadata: name: policy-lvmcluster-delete annotations: policy.open-cluster-management.io/standards: NIST SP 800-53 policy.open-cluster-management.io/categories: CM Configuration Management policy.open-cluster-management.io/controls: CM-2 Baseline Configuration spec: remediationAction: enforce disabled: false policy-templates: - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-lvmcluster-removal spec: remediationAction: enforce # the policy-template spec.remediationAction is overridden by the preceding parameter value for spec.remediationAction. severity: low object-templates: - complianceType: mustnothave objectDefinition: kind: LVMCluster apiVersion: lvm.topolvm.io/v1alpha1 metadata: name: odf-lvmcluster namespace: openshift-storage # must have namespace 'openshift-storage' --- apiVersion: policy.open-cluster-management.io/v1 kind: PlacementBinding metadata: name: binding-policy-lvmcluster-delete placementRef: apiGroup: apps.open-cluster-management.io kind: PlacementRule name: placement-policy-lvmcluster-delete subjects: - apiGroup: policy.open-cluster-management.io kind: Policy name: policy-lvmcluster-delete --- apiVersion: apps.open-cluster-management.io/v1 kind: PlacementRule metadata: name: placement-policy-lvmcluster-delete spec: clusterConditions: - status: 'True' type: ManagedClusterConditionAvailable clusterSelector: matchExpressions: - key: vendor operator: In values: - OpenShift
Create the policy by running the following command:
# oc create -f odf-lvmcluster-deletion.yaml -n lvm-policy-ns
Save the following YAML to a file with a name such as
check-odf-lvmcluster-deletion.yaml
to create a policy to check if theLVMCluster
CR has been removed.apiVersion: policy.open-cluster-management.io/v1 kind: Policy metadata: name: policy-lvmcluster-inform annotations: policy.open-cluster-management.io/standards: NIST SP 800-53 policy.open-cluster-management.io/categories: CM Configuration Management policy.open-cluster-management.io/controls: CM-2 Baseline Configuration spec: remediationAction: inform disabled: false policy-templates: - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-lvmcluster-removal-inform spec: remediationAction: inform # the policy-template spec.remediationAction is overridden by the preceding parameter value for spec.remediationAction. severity: low object-templates: - complianceType: mustnothave objectDefinition: kind: LVMCluster apiVersion: lvm.topolvm.io/v1alpha1 metadata: name: odf-lvmcluster namespace: openshift-storage # must have namespace 'openshift-storage' --- apiVersion: policy.open-cluster-management.io/v1 kind: PlacementBinding metadata: name: binding-policy-lvmcluster-check placementRef: apiGroup: apps.open-cluster-management.io kind: PlacementRule name: placement-policy-lvmcluster-check subjects: - apiGroup: policy.open-cluster-management.io kind: Policy name: policy-lvmcluster-inform --- apiVersion: apps.open-cluster-management.io/v1 kind: PlacementRule metadata: name: placement-policy-lvmcluster-check spec: clusterConditions: - status: 'True' type: ManagedClusterConditionAvailable clusterSelector: matchExpressions: - key: vendor operator: In values: - OpenShift
Create the policy by running the following command:
# oc create -f check-odf-lvmcluster-deletion.yaml -n lvm-policy-ns
Check the policy status.
# oc get policy -n lvm-policy-ns NAME REMEDIATION ACTION COMPLIANCE STATE AGE policy-lvmcluster-delete enforce Compliant 15m policy-lvmcluster-inform inform Compliant 15m
After both the policies are compliant, save the following YAML to a file with a name such as
odf-lvm-operator-remove-policy.yaml
to create a policy to uninstall the OpenShift Data Foundation Logical Volume Manager Operator.apiVersion: apps.open-cluster-management.io/v1 kind: PlacementRule metadata: name: placement-uninstall-odf-lvm-operator spec: clusterConditions: - status: "True" type: ManagedClusterConditionAvailable clusterSelector: matchExpressions: - key: vendor operator: In values: - OpenShift --- apiVersion: policy.open-cluster-management.io/v1 kind: PlacementBinding metadata: name: binding-uininstall-odf-lvm-operator placementRef: apiGroup: apps.open-cluster-management.io kind: PlacementRule name: placement-uninstall-odf-lvm-operator subjects: - apiGroup: policy.open-cluster-management.io kind: Policy name: uninstall-odf-lvm-operator --- 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: uninstall-odf-lvm-operator spec: disabled: false policy-templates: - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: uninstall-odf-lvm-operator spec: object-templates: - complianceType: mustnothave objectDefinition: apiVersion: v1 kind: Namespace metadata: name: openshift-storage - complianceType: mustnothave objectDefinition: apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: openshift-storage-operatorgroup namespace: openshift-storage spec: targetNamespaces: - openshift-storage - complianceType: mustnothave objectDefinition: apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: odf-lvm-operator namespace: openshift-storage spec: installPlanApproval: Automatic name: odf-lvm-operator source: redhat-operators sourceNamespace: openshift-marketplace remediationAction: enforce severity: low - objectDefinition: apiVersion: policy.open-cluster-management.io/v1 kind: ConfigurationPolicy metadata: name: policy-remove-lvm-operator-crds spec: object-templates: - complianceType: mustnothave objectDefinition: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: logicalvolumes.topolvm.cybozu.com - complianceType: mustnothave objectDefinition: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: lvmclusters.lvm.topolvm.io - complianceType: mustnothave objectDefinition: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: lvmvolumegroupnodestatuses.lvm.topolvm.io - complianceType: mustnothave objectDefinition: apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: lvmvolumegroups.lvm.topolvm.io remediationAction: enforce severity: high
Create the policy by running the following command:
# oc create -f odf-lvm-operator-remove-policy.yaml -ns lvm-policy-ns
Chapter 2. Deploying OpenShift Data Foundation on single node OpenShift clusters using OpenShift Web Console
2.1. Installing Red Hat OpenShift Data Foundation Logical Volume Manager Operator using OpenShift Web Console
You can install Red Hat OpenShift Data Foundation Logical Volume Manager Operator using the Red Hat OpenShift Container Platform Operator Hub.
Prerequisites
-
Access to an OpenShift Container Platform cluster using an account with
cluster-admin
and Operator installation permissions.
Ensure that no other storage provisioner is installed on the SNO cluster. OpenShift Data Foundation Logical Volume Manager Operator should be the only storage provisioner as it uses all available disks on the node.
Procedure
- Log in to the OpenShift Web Console.
- Click Operators → OperatorHub.
-
Scroll or type
ODF LVM Operator
into the Filter by keyword box to find the ODF LVM Operator. - Click Install.
Set the following options on the Install Operator page:
- Update Channel as stable-4.11.
- Installation Mode as A specific namespace on the cluster.
-
Installed Namespace as Operator recommended namespace openshift-storage. If Namespace
openshift-storage
does not exist, it is created during the operator installation. Select Approval Strategy as Automatic or Manual.
If you select Automatic updates, then the Operator Lifecycle Manager (OLM) automatically upgrades the running instance of your Operator without any intervention.
If you select Manual updates, then the OLM creates an update request. As a cluster administrator, you must then manually approve that update request to update the Operator to a newer version.
- Click Install.
Verification steps
- Verify that the ODF LVM Operator shows a green tick indicating successful installation.
2.2. Creating OpenShift Data Foundation Logical Volume Manager cluster
Create Logical Volume Manager cluster after you install the OpenShift Data Foundation Logical Volume Manager operator.
Prerequisites
- The OpenShift Data Foundation Logical Volume Manager operator must be installed from the Operator Hub.
Procedure
In the OpenShift Web Console, click Operators → Installed Operators to view all the installed operators.
Ensure that the Project selected is
openshift-storage
.- Click on the ODF LVM operator, and then click Create instance under LVMCluster.
- In the Create LVMCluster page, select either Form view or YAML view.
- Enter a name for the cluster.
- Click Create.
Verification Steps
- Click Storage → Storage Classes from the left pane of the OpenShift Web Console.
-
Verify that the
odf-lvm-<device-class-name>
storage class is created with the ODF LVM cluster creation. By default,vg1
is the device-class-name.
2.3. Uninstalling OpenShift Data Foundation Logical Volume Manager Operator installed using OpenShift Web Console
Prerequisites
Ensure that the following are deleted before deleting the policy:
- All the applications on the managed clusters that are using the storage provisioned by the OpenShift Data Foundation Logical Volume Manager Operator.
- Persistent volume claims (PVCs) and persistent volumes (PVs) provisioned using the OpenShift Data Foundation Logical Volume Manager Operator.
- All volume snapshots provisioned by the OpenShift Data Foundation Logical Volume Manager Operator.
-
Ensure that no logical volume resources exist by using the
oc get logicalvolume
command.
Procedure
Select the project
openshift-storage
.$ oc project openshift-storage
Display the pods.
$ oc get pods NAME READY STATUS RESTARTS AGE lvm-operator-controller-manager-54df65b5c4-n7bhb 3/3 Running 1 (45h ago) 7d2h topolvm-controller-645cb47cd4-kskqb 5/5 Running 5 (45h ago) 7d3h topolvm-node-7bqxp 4/4 Running 0 7d3h vg-manager-hwmg2 1/1 Running 0 7d
Display the
lvmcluster
.$ oc get lvmcluster NAME AGE odf-lvmcluster 7d3h
Delete the
lvmcluster
.$ oc delete lvmcluster odf-lvmcluster lvmcluster.lvm.topolvm.io "odf-lvmcluster" deleted
Verify the deletion by displaying the
lvmcluster
.$ oc get lvmcluster No resources found in openshift-storage namespace.
Wait until there is only the
lvm-operator
pod running.$ oc get pods NAME READY STATUS RESTARTS AGE lvm-operator-controller-manager-54df65b5c4-n7bhb 3/3 Running 1 (45h ago) 7d2h
Change the project to
default
.$ oc project default
Delete the project
openshift-storage
.$ oc delete project openshift-storage
Chapter 3. Provisioning storage using Logical Volume Manager Operator
You can provision persistent volume claims (PVCs) using the storage class that gets created during the operator installation. You can provision block and file PVCs, however, the storage is allocated only when a pod that uses the PVC is created.
The Red Hat OpenShift Data Foundation Logical Volume Manager Operator provisions PVCs in units of 1 GiB. The requested storage is rounded up to the nearest GiB.
Procedure
Identify the StorageClass that is created when Red Hat OpenShift Data Foundation Logical Volume Manager Operator is deployed.
The StorageClass name is in the format,
odf-lvm-<device-class-name>
.device-class-name
is the name of the device class that you provided in the LVMCluster of the policy YAML. For example, if the deviceClass has the name asvg1
, then the storageClass name isodf-lvm-vg1
.Save the following YAML to a file with a name such as
odf-lvm-storage-class.yaml
to create a PVC where the application requires storage.# Sample YAML to create a PVC # block pvc apiVersion: v1 kind: PersistentVolumeClaim metadata: name: lvm-block-1 namespace: default spec: accessModes: - ReadWriteOnce volumeMode: Block resources: requests: storage: 10Gi storageClassName: odf-lvm-vg1 --- # file pvc apiVersion: v1 kind: PersistentVolumeClaim metadata: name: lvm-file-1 namespace: default spec: accessModes: - ReadWriteOnce volumeMode: Filesystem resources: requests: storage: 10Gi storageClassName: odf-lvm-vg1
Create the policy by running the following command:
# oc create -f odf-lvm-storage-class.yaml -ns lvm-policy-ns
The PVCs that are created will remain in pending state until you deploy the pods that use them.
Chapter 4. Monitoring the OpenShift Data Foundation Logical Volume Manager Operator
When the OpenShift Data Foundation Logical Volume Manager Operator is installed using the OpenShift Web Console, you can monitor the cluster using the Block and File
dashboard in the console by default. However, when you use RHACM to install the OpenShift Data Foundation Logical Volume Manager Operator, you need to configure the RHACM Observability to monitor the all the SNO cluster from one place.
You can monitor the OpenShift Data Foundation Logical Volume Manager Operator by viewing the metrics exported by the operator on the RHACM dashboards and the alerts that are triggered. Enable RHACM Observability as described in the Observability guide.
- Metrics
-
Add the following
topolvm
metrics to the allow list as specified in the Adding custom metrics section:
topolvm_thinpool_data_percent topolvm_thinpool_metadata_percent topolvm_thinpool_size_bytes
-
Add the following
Metrics are updated every 10 minutes or when there is a change in the thin-pool, such as a new logical volume creation.
- Alerts
- When the thin pool and volume group are filled up, further operations fail and might lead to data loss. The Logical Volume Manager Operator sends the following alerts the usage of the thin pool and volume group crosses certain value:
Table 4.1. Alerts for Logical Volume Manager cluster in Red Hat Advanced Cluster Management for Kubernetes
Alert | Description |
---|---|
VolumeGroupUsageAtThresholdNearFull | This alert is triggered when both the volume group and thin pool utilization cross 75% on nodes. Data deletion or volume group expansion is required. |
VolumeGroupUsageAtThresholdCritical | This alert is triggered when both the volume group and thin pool utilization cross 85% on nodes.VolumeGroup is critically full. Data deletion or volume group expansion is required. |
ThinPoolDataUsageAtThresholdNearFull | This alert is triggered when the thin pool data utilization in the volume group crosses 75% on nodes. Data deletion or thin pool expansion is required. |
ThinPoolDataUsageAtThresholdCritical | This alert is triggered when the thin pool data utilization in the volume group crosses 85% on nodes. Data deletion or thin pool expansion is required. |
ThinPoolMetaDataUsageAtThresholdNearFull | This alert is triggered when the thin pool metadata utilization in the volume group crosses 75% on nodes. Data deletion or thin pool expansion is required. |
ThinPoolMetaDataUsageAtThresholdCritical | This alert is triggered when the thin pool metadata utilization in the volume group crosses 85% on nodes. Data deletion or thin pool expansion is required. |
Chapter 5. Volume snapshots for single node OpenShift
You can take volume snapshots of persistent volumes (PVs) that are provisioned by the OpenShift Data Foundation Logical Volume Manager Operator. You can also create volume snapshots of the cloned volumes. Volume snapshots help you to:
- Back up your application data (volume snapshots are not backups)
- Revert to a state at which the volume snapshot was taken
You can create volume snapshots based on the available capacity of the thin pool and overprovisioning limits. The Red Hat OpenShift Data Foundation Logical Volume Manager Operator creates a VolumeSnapshotClass
with the name odf-lvm-<deviceclass-name>
.
5.1. Creating volume snapshots in single node openshift
Prerequisites
- For a consistent snapshot, ensure that the PVC is in Bound state. Also, ensure that all the I/O to the PVC is stopped before taking the snapshot.
Procedure
Save the following YAML to a file with a name such as
odf-lvm-vol-snapshot.yaml
to create a policy for volume snapshot.# Sample YAML to create a volume snapshot apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshot metadata: name: lvm-block-1-snap spec: volumeSnapshotClassName: odf-lvm-vg1 source: persistentVolumeClaimName: lvm-block-1
Create the policy by running the following command:
# oc create -f odf-lvm-vol-snapshot.yaml -ns lvm-policy-ns
A read only copy of the PVC is created as a volume snapshot.
5.2. Restoring volume snapshots in single node openshift
When you restore a volume snapshot, a new Persistent Volume Claim (PVC) gets created. The restored PVC is independent of the volume snapshot and the source PVC.
Prerequisites
- The storage class must be the same as that of the source PVC.
- The size of the requested PVC must be the same as that of the source volume of the snapshot.
Procedure
- Identify the storage class name of the source PVC and volume snapshot name.
Save the following YAML to a file with a name such as
odf-lvm-vol-restore.yaml
to restore the snapshot.# Sample YAML to restore a PVC. kind: PersistentVolumeClaim apiVersion: v1 metadata: name: lvm-block-1-restore spec: accessModes: - ReadWriteOnce volumeMode: Block Resources: Requests: storage: 2Gi storageClassName: odf-lvm-vg1 dataSource: name: lvm-block-1-snap kind: VolumeSnapshot apiGroup: snapshot.storage.k8s.io
Create the policy by running the following command:
# oc create -f odf-lvm-vol-restore.yaml -ns lvm-policy-ns
5.3. Deleting volume snapshots in single node openshift
Procedure
To delete the volume snapshot, delete the volume snapshot resource.
oc delete volumesnapshot <volume-snapshot-name> -n <namespace>
NoteWhen you delete a persistent volume claim (PVC), the snapshots of the PVC are not deleted.
- To delete the restored volume snapshot, delete the PVC that was created to restore the volume snapshot.
oc delete pvc <pvc-name> -n <namespace>
Chapter 6. Volume cloning for single node OpenShift
A clone is a duplicate of an existing storage volume that can be used like any standard volume. You create a clone of a volume to make a point in time copy of the data. A persistent volume claim (PVC) cannot be cloned with a different size.
6.1. Creating volume clones in single node openshift
Prerequisites
- Ensure that the source PVC is in Bound state and not in use.
- Ensure that the StorageClass is the same as that of the parent.
Procedure
- Identify the storage class of the source PVC.
Save the following YAML to a file with a name such as
odf-lvm-vol-clone.yaml
to create a volume clone.# Sample YAML to clone a volume # pvc-clone.yaml apiVersion: v1 kind: PersistentVolumeClaim Metadata: name: lvm-block-1-clone Spec: storageClassName: odf-lvm-vg1 dataSource: name: lvm-block-1 kind: PersistentVolumeClaim accessModes: - ReadWriteOnce volumeMode: Block Resources: Requests: storage: 2Gi The cloned PVC has write access.
- Create the policy by running the following command:
# oc create -f odf-lvm-vol-clone.yaml -ns lvm-policy-ns
6.2. Deleting cloned volumes in single node openshift
Procedure
- To delete the cloned volume, you can delete the cloned PVC.
oc delete pvc <clone-pvc-name> -n <namespace>