28.3.4. 创建持久性卷
接下来,在 OpenShift Container Platform 中创建 PV 对象前,定义持久性卷文件:
例 28.6. 使用 Ceph RBD 的持久性卷对象定义
apiVersion: v1 kind: PersistentVolume metadata: name: ceph-pv 1 spec: capacity: storage: 2Gi 2 accessModes: - ReadWriteOnce 3 rbd: 4 monitors: 5 - 192.168.122.133:6789 pool: rbd image: ceph-image user: admin secretRef: name: ceph-secret 6 fsType: ext4 7 readOnly: false persistentVolumeReclaimPolicy: Retain
将 PV 定义保存到文件中,如 ceph-pv.yaml 并创建持久性卷:
# oc create -f ceph-pv.yaml persistentvolume "ceph-pv" created
验证持久性卷是否已创建:
# oc get pv NAME LABELS CAPACITY ACCESSMODES STATUS CLAIM REASON AGE ceph-pv <none> 2147483648 RWO Available 2s