이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 29. Expanding Persistent Volumes


29.1. Enabling Expansion of Persistent Volume Claims

Volume expansion is a Technology Preview feature, and hence, is not enabled by default in your OpenShift Container Platform 3.10 cluster. There may be other reasons that OpenShift Container Platform administrators wish to enable this feature for certain use cases.

Note

For more information on Red Hat Technology Preview features support scope, see https://access.redhat.com/support/offerings/techpreview/.

To allow expansion of persistent volume claims (PVC) by OpenShift Container Platform users, OpenShift Container Platform administrators must create or update a StorageClass with allowVolumeExpansion set to true. Only PVCs created from that class are allowed to expand.

Apart from that, OpenShift Container Platform administrators must enable the ExpandPersistentVolumes feature flag and turn on the PersistentVolumeClaimResize admission controller. Refer to Admission Controllers for more information on the PersistentVolumeClaimResize admission controller.

To enable the feature gate, set ExpandPersistentVolumes to true across the system:

  1. Configure the appropriate node configuration map:

    # oc edit configmaps <name> -n openshift-node

    For example:

    oc edit cm node-config-compute -n openshift-node
    ...
    kubeletArguments:
    ...
      feature-gates:
      - ExpandPersistentVolumes=true
  2. Enable the ExpandPersistentVolumes feature gate on the master API and controller manager:

    # cat /etc/origin/master/master-config.yaml
    ...
    kubernetesMasterConfig:
      apiServerArguments:
      ...
        feature-gates:
        - ExpandPersistentVolumes=true
      controllerArguments:
        ...
        feature-gates:
        - ExpandPersistentVolumes=true
    
    # master-restart api
    # master-restart controllers

29.2. Expanding GlusterFS-Based Persistent Volume Claims

Once the OpenShift Container Platform administrator has created a StorageClass with allowVolumeExpansion set to true, you can create a PVC from that class, and afterwards, whenever needed, you can edit the PVC and request a new size.

For example:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: gluster-mysql
spec:
  storageClass: "storageClassWithFlagSet"
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 8Gi 1
1
You can request an expanded volume by updating spec.resources.requests.

29.3. Expanding Persistent Volume Claims with a File System

Expanding PVCs based on volume types that need file system resizing (such as GCE PD, EBS, and Cinder) is a two-step process. This process usually involves expanding volume objects in the CloudProvider, and then expanding the file system on the actual node.

Expanding the file system on the node only happens when a new pod is started with the volume.

The following process assumes that the PVC was previously created from a StorageClass with allowVolumeExpansion set to true:

  1. Edit the PVC and request a new size by editing spec.resources.requests. Once the CloudProvider object has finished resizing, the PVC is set to FileSystemResizePending.
  2. Type the following command to check the condition:
  oc describe pvc <pvc_name>

When the CloudProvider object has finished resizing, the persistent volume (PV) object reflects the newly requested size in PersistentVolume.Spec.Capacity. At this point, you can create or re-create a new pod from the PVC to finish the file system resizing. Once the pod is running, the newly requested size is available and FileSystemResizePending condition is removed from the PVC.

29.4. Recovering from Failure when Expanding Volumes

If expanding underlying storage fails either on master or node, the OpenShift Container Platform administrator can manually recover the PVC state and cancel the resize requests that are continuously retried by the controller without administrator intervention.

Currently, this can be done manually by completing the following steps:

  1. Mark the PV that is bound to the claim (PVC) with the Retain reclaim policy. This can be done by editing the PV and changing persistentVolumeReclaimPolicy to Retain.
  2. Delete the PVC (it will be recreated later).
  3. To ensure that the newly created PVC can bind to the PV marked Retain, manually edit the PV and delete the claimRef entry from the PV specs. This marks the PV as Available. For more information about prebinding PVCs, see volume and claim prebinding.
  4. Re-create the PVC in a smaller size or a size that can be allocated by the underlying storage provider. Also, set the volumeName field of the PVC to the name of the PV. This binds the PVC to the provisioned PV only.
  5. Restore the reclaim policy on the PV.
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.