5kits zhao

Create persistent volume (PV) in openshift 3.11 OKD

Contents

[ hide ]


    1- create file with name registry-volume.yaml  or any name.yaml

    2-  vi registry-volume.yaml  and place the following

    ============
    apiVersion: v1
    kind: PersistentVolume
    metadata:
    name: registry-wordpresspv
    spec:
    capacity:
    storage: 5Gi
    accessModes:
    - ReadWriteMany
    nfs:
    path: /okd_test
    server: 192.168.212.13
    persistentVolumeReclaimPolicy: Recycle
    claimRef:
    name: registry-wordpresspvc
    namespace: el-website
    ============

    make sure to change the namespace to the default project or any project name

    3- run the following command

    oc create -f registry-volume.yaml

    that is all for PV and in order to create persistent volume claims (PVC) then you need to run the following command

    oc set volume dc/docker-registry -n default –add –overwrite –name=registry-storage -t pvc –claim-name=registry-pvclaim –claim-size=5Gi –claim-mode=’ReadWritemany’

    just make sure to change names such as registry-pvclaim or registry-storage because they are only names

     

    Leave a Reply