Search code examples
kubernetesopenshiftopenshift-originokd

Persistent Volume and OpenShift 3.11


I've just installed OpenShift-Okd 3.11, and am trying out a persistent Postgres database.

After attempting to create the database, I get the following error:

MountVolume.SetUp failed for volume "postgresql" : 
mount failed: exit status 32 Mounting command: systemd-run Mounting arguments: --description=Kubernetes transient mount for /var/lib/origin/openshift.local.volumes/pods/b76a314a-d59a-11e8-a502-6c626d58b24d/volumes/kubernetes.io~nfs/postgresql --scope -- mount -t nfs apps.mydomain.com:/pg-data /var/lib/origin/openshift.local.volumes/pods/b76a314a-d59a-11e8-a502-6c626d58b24d/volumes/kubernetes.io~nfs/postgresql Output: 
Running scope as unit run-7329.scope. mount.nfs: Protocol not supported

I have also create the following persistent volume:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: postgresql 
spec:
  capacity:
    storage: 5Gi 
  accessModes:
  - ReadWriteOnce 
  nfs: 
    path: /pg-data 
    server: apps.mydomain.com 
  persistentVolumeReclaimPolicy: Retain

Even after creating the PV (using oc create -f pv.yml) I still get the above error.


Solution

  • Looks like you don't have an NFS server running on apps.mydomain.com, you need to have an NFS server exporting directories that can be mounted remotely an NFS client, in this case your Postgres pod.

    If you not sure how to setup an NFS server, you can follow this guide to install it in Kubernetes.

    You can also run an NFS server outside Kubernetes if you'd like to. Here's another guide to setup and NFS server on RHEL 7.