在我们的 OpenShift 3.11 集群中,我们尝试通过 PersistentVolume 和之前在外部 NFS 存储(Isilon 存储)上创建的 NFS 卷来使用 NFS。我们在 Kubernetes/OpenShift 层上成功创建并应用了 PersistentVolume 和 PersistentVolumeClaim。PVC 正确绑定了 PV,但是在检查部署事件时,我们在挂载 NFS 阶段遇到错误。
持久卷:
apiVersion: v1
kind: PersistentVolume
metadata:
name: tool1pv
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteOnce
nfs:
path: /tool1shareenv1
server: tommytheserver.companydomain.priv
persistentVolumeReclaimPolicy: Retain
claimRef:
name: tool1claimenv1
namespace: ocpnamespace1
PersistentVolumeClaim:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: tool1claimenv1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
volumeName: tool1pvenv1
检查开发事件时,我们看到“没有这样的文件”:
MountVolume.SetUp failed for volume "tool1pvenv1" : mount failed:
exit status 32 Mounting command: systemd-run Mounting arguments: --description=Kubernetes transient mount for /var/lib/origin/openshift.local.volumes/pods/f1cb1291-fe12-01ea-bb92-0050123aa39be/volumes/kubernetes.io~nfs/tool1pvenv1 --scope -- mount -t nfs tommytheserver.companydomain.priv:/tool1shareenv1
/var/lib/origin/openshift.local.volumes/pods/f1cb9191-fe73-11ea-bb92-005056ba12be/volumes/kubernetes.io~nfs/tool1pvenv1d Output: Running scope as unit run-74039.scope. **mount.nfs: mounting tommytheserver.companydomain.priv:/tool1env1 failed, reason given by server: No such file or directory**
我们调查了server
和path
领域并尝试了不同的变化,例如:
持久卷版本2:
apiVersion: v1
kind: PersistentVolume
metadata:
name: tool1pv
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteOnce
nfs:
path: /tool1shareenv1
server: tommytheserver.companydomain.priv/tool1shareenv1
persistentVolumeReclaimPolicy: Retain
claimRef:
name: tool1claimenv1
namespace: ocpnamespace1
但我们仍然面临同样的No such file
错误。
我们如何解决它?