2022-12-19 15:15:37 -05:00
// Module included in the following assemblies:
//
2023-02-06 15:26:09 -05:00
// * microshift_storage/microshift-storage-plugin-overview.adoc
2022-12-19 15:15:37 -05:00
2023-10-30 10:13:25 -04:00
:_mod-docs-content-type: PROCEDURE
2023-03-16 17:11:35 -04:00
[id="microshift-lvms-using_{context}"]
2022-12-19 15:15:37 -05:00
= Using the LVMS
2023-03-16 17:11:35 -04:00
The LVMS `StorageClass` is deployed with a default `StorageClass`. Any `PersistentVolumeClaim` objects without a `.spec.storageClassName` defined automatically has a `PersistentVolume` provisioned from the default `StorageClass`. Use the following procedure to provision and mount a logical volume to a pod.
2022-12-19 15:15:37 -05:00
2022-12-13 16:10:10 -05:00
.Procedure
2022-12-19 15:15:37 -05:00
2023-03-16 17:11:35 -04:00
* To provision and mount a logical volume to a pod, run the following command:
2022-12-19 15:15:37 -05:00
+
[source,terminal]
----
2023-03-20 10:35:25 -04:00
$ cat <<EOF | oc apply -f -
2022-12-19 15:15:37 -05:00
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: my-lv-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1G
---
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: nginx
image: nginx
command: ["/usr/bin/sh", "-c"]
args: ["sleep", "1h"]
volumeMounts:
- mountPath: /mnt
name: my-volume
2023-03-16 17:11:35 -04:00
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
2022-12-19 15:15:37 -05:00
volumes:
- name: my-volume
persistentVolumeClaim:
claimName: my-lv-pvc
EOF
----