Configuring NFS storage

Reference: See section 9.1. Configuring the Block Storage service with a generic NFS back end from Deploying Red Hat OpenStack Platform 18.0 Development Preview 3 on Red Hat OpenShift Container Platform guide.

  1. Create an NFS share for cinder

    mkdir /nfs/cinder
    chmod 777 /nfs/cinder
  2. Create directories for NFS persistent volumes.

    mkdir /nfs/pv6
    mkdir /nfs/pv7
    mkdir /nfs/pv8
    mkdir /nfs/pv9
    mkdir /nfs/pv10
    mkdir /nfs/pv11
    chmod 777 /nfs/pv*
  3. Configure NFS storage class

    1. Use below sample configuration to create nfs sorage class:

      apiVersion: storage.k8s.io/v1
      kind: StorageClass
      metadata:
         name: nfs
      provisioner: kubernetes.io/no-provisioner
      reclaimPolicy: Delete
    2. Use below sample configuration to create persistent volume of type NFS

      apiVersion: v1
      kind: PersistentVolume
      metadata:
        name: nfs-pv1
      spec:
        accessModes:
        - ReadWriteOnce
        - ReadWriteMany
        capacity:
          storage: 100Gi
        nfs:
          path: /nfs/pv1
          server: 192.168.123.100
        persistentVolumeReclaimPolicy: Delete
        storageClassName: nfs
        volumeMode: Filesystem
    3. Create copies of the above block for PersistentVolume.

    4. Use the simila block for creating different physicle volumes.

    5. Change the name and the path accordingly.

    6. You may add your configuration for creation of nfs StorageClass and PersistentVolumes in one file.

      vi nfs-storage.yaml
  4. Apply the nfs storage configuration.

    oc apply -f nfs-storage.yaml

Reference: 9.1.1. Creating the NFS server connection secret

  1. Prepare the nfs cinder configuration file as below:

    cat >> nfs-cinder-conf << EOF
    [nfs]
    nas_host=192.168.123.100
    nas_share_path=/nfs/cinder
    EOF
  2. Prepare the secret to place the NFS server connection used by Cinder.

    oc create secret generic cinder-nfs-config --from-file=nfs-cinder-conf
  3. Prepare the glance configuration file as below:

    cat >> glance-conf << EOF
    [default_backend]
    cinder_store_user_name = glance
    cinder_store_password = openstack
    cinder_store_project_name = service[root@ocp4-bastion demo-lab]#
    EOF
  4. Prepare the secret to place the server connection used by Glance.

    oc create secret generic glance-cinder-config --from-file=glance-conf