From 2a21df36a1be3ec2ac997e962ec42c68e8de8060 Mon Sep 17 00:00:00 2001 From: Bob Furu Date: Mon, 4 May 2020 15:47:09 -0400 Subject: [PATCH] BZ1783437 - Add PVC to vSphere --- ...t-storage-vsphere-static-provisioning.adoc | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/modules/persistent-storage-vsphere-static-provisioning.adoc b/modules/persistent-storage-vsphere-static-provisioning.adoc index 225f4bf7a4dd..86f88f566235 100644 --- a/modules/persistent-storage-vsphere-static-provisioning.adoc +++ b/modules/persistent-storage-vsphere-static-provisioning.adoc @@ -18,7 +18,7 @@ To statically provision VMware vSphere volumes you must create the virtual machi * Create using `vmkfstools`. Access ESX through Secure Shell (SSH) and then use following command to create a VMDK volume: + ---- -$ vmkfstools -c /vmfs/volumes/DatastoreName/volumes/.vmdk +$ vmkfstools -c /vmfs/volumes//volumes/.vmdk ---- * Create using `vmware-diskmanager`: @@ -27,17 +27,17 @@ $ vmkfstools -c /vmfs/volumes/DatastoreName/volumes/.vmdk $ shell vmware-vdiskmanager -c -t 0 -s -a lsilogic .vmdk ---- -. Create a PersistentVolume that references the VMDKs. Create a file, `pv.yaml`, with the PersistentVolume object definition: +. Create a PersistentVolume that references the VMDKs. Create a file, `pv1.yaml`, with the PersistentVolume object definition: + [source,yaml] ---- apiVersion: v1 kind: PersistentVolume metadata: - name: pv <1> + name: pv1 <1> spec: capacity: - storage: 2Gi <2> + storage: 1Gi <2> accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain @@ -47,9 +47,9 @@ spec: ---- <1> The name of the volume. This name is how it is identified by PersistentVolumeClaims or Pods. <2> The amount of storage allocated to this volume. -<3> The volume type used, with `vsphereVolume` for vSphere volumes. The label is used to mount a vSphere VMDK volume into pods. The contents of a volume are preserved when it is unmounted. The volume type supports VMFS and VSAN datastore. -<4> The existing VMDK volume to use. You must enclose the datastore name in square brackets, `[]`, in the volume definition, as shown previously. -<5> The file system type to mount. For example, ext4, xfs, or other file-systems. +<3> The volume type used, with `vsphereVolume` for vSphere volumes. The label is used to mount a vSphere VMDK volume into Pods. The contents of a volume are preserved when it is unmounted. The volume type supports VMFS and VSAN datastore. +<4> The existing VMDK volume to use. If you used `vmkfstools`, you must enclose the datastore name in square brackets, `[]`, in the volume definition, as shown previously. +<5> The file system type to mount. For example, ext4, xfs, or other file systems. + [IMPORTANT] ==== @@ -59,5 +59,32 @@ Changing the value of the fsType parameter after the volume is formatted and pro . Create the PersistentVolume from the file: + ---- -$ oc create -f pv.yaml +$ oc create -f pv1.yaml +---- + +. Create a PersistentVolumeClaim that maps to the PersistentVolume you created in the previous step. Create a file, `pvc1.yaml`, with the PersistentVolumeClaim object definition: ++ +[source,yaml] +---- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pvc1 <1> +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: "1Gi" <3> + volumeName: pv1 <4> +---- +<1> A unique name that represents the PersistentVolumeClaim. +<2> The PersistentVolumeClaim’s access mode. With ReadWriteOnce, the volume can be mounted with read and write permissions by a single node. +<3> The size of the PersistentVolumeClaim. +<4> The name of the existing PersistentVolume. + +. Create the PersistentVolumeClaim from the file: ++ +---- +$ oc create -f pvc1.yaml ----