Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BZ1783437 - Add PVC to vSphere #21805

Merged
merged 1 commit into from
May 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions modules/persistent-storage-vsphere-static-provisioning.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <size> /vmfs/volumes/DatastoreName/volumes/<disk-name>.vmdk
$ vmkfstools -c <size> /vmfs/volumes/<datastore-name>/volumes/<disk-name>.vmdk
----

* Create using `vmware-diskmanager`:
Expand All @@ -27,17 +27,17 @@ $ vmkfstools -c <size> /vmfs/volumes/DatastoreName/volumes/<disk-name>.vmdk
$ shell vmware-vdiskmanager -c -t 0 -s <size> -a lsilogic <disk-name>.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
Expand All @@ -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]
====
Expand All @@ -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
----