docs/doc/source/usertasks/kubernetes/kubernetes-user-tutorials-create-readwritemany-persistent-volume-claims.rst
Juanita-Balaraj 63cd4f5fdc CephFS RWX Support in Host-based Ceph
Incorporated patchset 1 review comments
Updated patchset 5 review comments
Updated patchset 6 review comments
Fixed merge conflicts
Updated patchset 8 review comments

Change-Id: Icd7b08ab69273f6073b960a13cf59905532f851a
Signed-off-by: Juanita-Balaraj <juanita.balaraj@windriver.com>
2021-05-03 16:39:45 -04:00

2.2 KiB

Create ReadWriteMany Persistent Volume Claims

Container images have an ephemeral file system by default. For data to survive beyond the lifetime of a container, it can read and write files to a volume obtained with a Persistent Volume Claim (PVC) created to provide persistent storage.

For multiple containers to mount the same PVC, create a PVC with accessMode of ReadWriteMany (RWX).

The following steps show an example of creating a 1GB with ReadWriteMany accessMode.

  1. Create the rwx-test-claim Persistent Volume Claim.
    1. Create a yaml file defining the claim and its attributes. For example:

      ~(keystone_admin)]$ cat <<EOF > rwx-claim.yaml
      kind: PersistentVolumeClaim
      apiVersion: v1
      metadata:
        name: rwx-test-claim
      spec:
        accessModes:
        - ReadWriteMany
        resources:
          requests:
            storage: 1Gi
        storageClassName: cephfs
      EOF
    2. Apply the settings created above.

      ~(keystone_admin)]$ kubectl apply -f rwx-claim.yaml
      persistentvolumeclaim/rwx-test-claim created

1GB PVC has been created. You can view the PVCs using the following command.

~(keystone_admin)]$ kubectl get persistentvolumeclaims

NAME              STATUS   VOLUME       CAPACITY   ACCESS MODES   STORAGECLASS
rwx-test-claim    Bound    pvc-df9f..   1Gi        RWX            cephfs
~(keystone_admin)]$ kubectl get persistentvolume
NAME       CAPACITY ACCESS.. RECLAIM.. STATUS CLAIM                   STORAGECLASS
pvc-df9f.. 1Gi      RWX       Delete    Bound  default/rwx-test-claim  cephfs

For more information on using CephFS for internal Ceph backends, see, About Persistent Volume Support <about-persistent-volume-support>.