|
| 1 | +[[expanding_persistent_volumes]] |
| 2 | += Expanding Persistent Volumes |
| 3 | +{product-author} |
| 4 | +{product-version} |
| 5 | +:data-uri: |
| 6 | +:icons: |
| 7 | +:experimental: |
| 8 | +:toc: macro |
| 9 | +:toc-title: |
| 10 | + |
| 11 | +toc::[] |
| 12 | + |
| 13 | +[[enabling_expansion_pvc]] |
| 14 | +== Enabling Expansion of Persistent Volume Claims |
| 15 | + |
| 16 | +Volume expansion is a Technology Preview feature, and hence, is not enabled by |
| 17 | +default in your {product-title} {product-version} cluster. There may be other reasons that |
| 18 | +{product-title} administrators wish to enable this feature for certain use |
| 19 | +cases. |
| 20 | + |
| 21 | +[NOTE] |
| 22 | +==== |
| 23 | +For more information on Red Hat Technology Preview features support scope, see |
| 24 | +https://access.redhat.com/support/offerings/techpreview/. |
| 25 | +==== |
| 26 | + |
| 27 | +To allow expansion of persistent volume claims (PVC) by {product-title} users, |
| 28 | +{product-title} administrators must create or update a StorageClass with |
| 29 | +`allowVolumeExpansion` set to `true`. Only PVCs created from that class are |
| 30 | +allowed to expand. |
| 31 | + |
| 32 | +Apart from that, {product-title} administrators must enable the |
| 33 | +`ExpandPersistentVolumes` feature flag and turn on the |
| 34 | +`PersistentVolumeClaimResize` admission controller. Refer to |
| 35 | +xref:../architecture/additional_concepts/admission_controllers.adoc#architecture-additional-concepts-admission-controllers[Admission Controllers] |
| 36 | +for more information on the `PersistentVolumeClaimResize` admission controller. |
| 37 | + |
| 38 | +To enable the feature gate, set `ExpandPersistentVolumes` to `true` across the system: |
| 39 | + |
| 40 | +. Configure node-config.yaml on all nodes in the cluster: |
| 41 | ++ |
| 42 | +---- |
| 43 | +# cat /etc/origin/node/node-config.yaml |
| 44 | +... |
| 45 | +kubeletArguments: |
| 46 | +... |
| 47 | + feature-gates: |
| 48 | + - ExpandPersistentVolumes=true |
| 49 | +# systemctl restart atomic-openshift-node |
| 50 | +---- |
| 51 | + |
| 52 | +. Enable the `ExpandPersistentVolumes` feature gate on the master API: |
| 53 | ++ |
| 54 | +---- |
| 55 | +# cat /etc/origin/master/master-config.yaml |
| 56 | +... |
| 57 | +kubernetesMasterConfig: |
| 58 | + apiServerArguments: |
| 59 | + ... |
| 60 | + feature-gates: |
| 61 | + - ExpandPersistentVolumes=true |
| 62 | +
|
| 63 | +# systemctl restart atomic-openshift-master-api |
| 64 | +---- |
| 65 | + |
| 66 | +[[expanding_glusterfs_pvc]] |
| 67 | +== Expanding GlusterFS-Based Persistent Volume Claims |
| 68 | + |
| 69 | +Expanding GlusterFS volumes is easiest. Once the {product-title} administrator |
| 70 | +has created a StorageClass with `allowVolumeExpansion` set to `true`, you can |
| 71 | +create a PVC from that class, and afterwards, whenever needed, you can edit the |
| 72 | +PVC and request a new size. |
| 73 | + |
| 74 | +For example: |
| 75 | + |
| 76 | +---- |
| 77 | +kind: PersistentVolumeClaim |
| 78 | +apiVersion: v1 |
| 79 | +metadata: |
| 80 | + name: gluster-mysql |
| 81 | +spec: |
| 82 | + storageClass: "storageClassWithFlagSet" |
| 83 | + accessModes: |
| 84 | + - ReadWriteOnce |
| 85 | + resources: |
| 86 | + requests: |
| 87 | + storage: 8Gi <1> |
| 88 | +---- |
| 89 | +<1> You can request an expanded volume by updating `spec.resources.requests`. |
| 90 | + |
| 91 | +[[expanding_file_system_pvc]] |
| 92 | +== Expanding Persistent Volume Claims with a File System |
| 93 | + |
| 94 | +Expanding PVCs based on volume types that need file system resizing (such as GCE |
| 95 | +PD, EBS, and Cinder) is a two-step process. This process usually involves |
| 96 | +expanding volume objects in the CloudProvider, and then expanding the file |
| 97 | +system on the actual node. |
| 98 | + |
| 99 | +Expanding the file system on the node only happens when a new pod is started |
| 100 | +with the volume. |
| 101 | + |
| 102 | +The following process assumes that the PVC was previously created from a |
| 103 | +StorageClass with `allowVolumeExpansion` set to `true`: |
| 104 | + |
| 105 | +. Edit the PVC and request a new size by editing `spec.resources.requests`. Once |
| 106 | +the CloudProvider object has finished resizing, the PVC is set to |
| 107 | +`FileSystemResizePending`. |
| 108 | + |
| 109 | +. Type the following command to check the condition: |
| 110 | +---- |
| 111 | + oc describe pvc <pvc_name> |
| 112 | +---- |
| 113 | + |
| 114 | +When the CloudProvider object has finished resizing, the persistent volume (PV) |
| 115 | +object reflects the newly requested size in `PersistentVolume.Spec.Capacity`. At |
| 116 | +this point, you can create or re-create a new pod from the PVC to finish the |
| 117 | +file system resizing. Once the pod is running, the newly requested size is |
| 118 | +available and `FileSystemResizePending` condition is removed from the PVC. |
0 commit comments