Openshift - Volumes
Commands
Storage Class
List storage class:
Persistent Volume (PV)
List all PV:
PV Detail:
Force PV deletion:
oc delete pv {pv-name} --grace-period=0 --force
oc patch pv {pv-name} -p '{"metadata": {"finalizers": null}}'
Persistent Volume Claim (PVC)
List all PVC:
PVC Detail:
Manifests
Persistent Volume Claim (PVC)
See an example of PVC manifest:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ceph-pvc-1
namespace: my-ns
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: sc-ceph-rbd
Procedures
Resize PVC
Edit PVC:
Edit spec/resources/requests/storage with new value:
Check new size from pvc attribute:
Info
For OCP 3.*, you must restart the pod to take into account new size.
Check FS size from pod:
Tips
List all CSI Ceph volume with jq:
oc get pv -o json | jq '
.items[]
| select(.spec.csi.driver == "openshift-storage.rbd.csi.ceph.com")
| .spec.claimRef.namespace
+ ";" + .spec.claimRef.name
+ ";" + .spec.csi.volumeAttributes.imageName
' | tr -d '"' | column -t -s';'