docs/doc/source/usertasks/kubernetes-user-tutorials-creating-persistent-volume-claims.rst
Stone f63f0912c6 User Tasks guide
Fixed typo in LetsEncrypt example

Removed duplicate Datanet entry from main index.rst

Reworked Use Kubernetes CPU Manager Static Policy prerequisite block.

Restored fault/index version of FM toctree in top-level index.

Added merged doc entries to top level index.rst.

Incorporated review comments. Also some generic formatting clean-up such as
converting abbreviations to rST-style :abbr: markup.

Moved url with embedded substitution out of code-block.

Addressed patch 2 review comments. Some addtional rST tidying. See comment replies
for open questions/issues.

This patch fixes an issue with 'stx' in filenames that may differ downstream using-an-image-from-the-local-docker-registry-in-a-container-spec
new substitution and changing code-blocks to parsed-literals as required.

Initial submission for review. Note that a couple of references to WR persist
in examples. These will be marked up with comments in the review.

Signed-off-by: Stone <ronald.stone@windriver.com>
Change-Id: I1efef569842caff5def9dc00395b594d91d7a5d0
Signed-off-by: Stone <ronald.stone@windriver.com>
2020-12-02 10:34:53 -05:00

2.5 KiB

Create 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 persistent volume obtained with a PVC (Persistent Volume Claim) created to provide persistent storage.

The following steps create two 1Gb persistent volume claims.

  1. Create the test-claim1 persistent volume claim.
    1. Create a yaml file defining the claim and its attributes.

      For example:

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

      ~(keystone_admin)$ kubectl apply -f claim1.yaml
      persistentvolumeclaim/test-claim1 created
  2. Create the test-claim2 persistent volume claim.
    1. Create a yaml file defining the claim and its attributes.

      For example:

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

      ~(keystone_admin)$ kubectl apply -f claim2.yaml
      persistentvolumeclaim/test-claim2 created

Two 1Gb persistent volume claims have been created. You can view them with the following command.

~(keystone_admin)$ kubectl get persistentvolumeclaims
NAME          STATUS   VOLUME      CAPACITY   ACCESS MODES   STORAGECLASS   AGE
test-claim1   Bound    pvc-aaca..  1Gi        RWO            general        2m56s
test-claim2   Bound    pvc-e93f..  1Gi        RWO            general        68s