Unable to mount volumes for pod Unable to mount volumes for pod kubernetes kubernetes

Unable to mount volumes for pod


Logs showed Oct 21 10:44:52 ip-10-0-0-129 origin-node: Output: mount.nfs: access denied by server while mounting localhost:/home/data/pv0002

So it failed mounting on localhost. to create my persistent volume I've executed this yaml:

{  "apiVersion": "v1",  "kind": "PersistentVolume",  "metadata": {    "name": "registry-volume"  },  "spec": {    "capacity": {        "storage": "20Gi"        },    "accessModes": [ "ReadWriteMany" ],    "nfs": {        "path": "/home/data/pv0002",        "server": "localhost"    }  }}

So I was mounting to /home/data/pv0002 but this path was not on the localhost but on my master server (which is ose3-master.example.com. So I created my PV in a wrong way.

{  "apiVersion": "v1",  "kind": "PersistentVolume",  "metadata": {    "name": "registry-volume"  },  "spec": {    "capacity": {        "storage": "20Gi"        },    "accessModes": [ "ReadWriteMany" ],    "nfs": {        "path": "/home/data/pv0002",        "server": "ose3-master.example.com"    }  }}

This was also in a training environment. It's recommended to have a NFS server outside of your cluster to mount to.