我的 PersistentVolumeClaim 不会绑定到 NFS PersistentVolume——我做错了什么?
My PersistentVolumeClaim won't bind to NFS PersistentVolume -- what am I doing wrong?
我的 PersistentVolume 配置如下:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
nfs:
path: /volume2/K8s_NFS
server: 172.16.66.50
persistentVolumeReclaimPolicy: Recycle
我的 PVC 是这样配置的:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-claim1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
这似乎与我匹配,但结果是它没有绑定:
Name: nfs-claim1
Namespace: default
StorageClass:
Status: Pending
Volume:
Labels: <none>
Annotations: <none>
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Used By: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal FailedBinding 86s (x26 over 7m33s) persistentvolume-controller no persistent volumes available for this claim and no storage class is set
我已确认我集群中的所有三个节点都可以装载该卷。我错过了什么?
您必须在规范中定义 storageClassName,它将用于将 PersistentVolumeClaim 请求绑定到 PersistentVolume。
更新配置,持久卷:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
storageClassName: manual
claimRef:
name: nfs-claim1
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
nfs:
path: /volume2/K8s_NFS
server: 172.16.66.50
persistentVolumeReclaimPolicy: Recycle
持久卷声明:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-claim1
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
我的 PersistentVolume 配置如下:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
nfs:
path: /volume2/K8s_NFS
server: 172.16.66.50
persistentVolumeReclaimPolicy: Recycle
我的 PVC 是这样配置的:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-claim1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
这似乎与我匹配,但结果是它没有绑定:
Name: nfs-claim1
Namespace: default
StorageClass:
Status: Pending
Volume:
Labels: <none>
Annotations: <none>
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Used By: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal FailedBinding 86s (x26 over 7m33s) persistentvolume-controller no persistent volumes available for this claim and no storage class is set
我已确认我集群中的所有三个节点都可以装载该卷。我错过了什么?
您必须在规范中定义 storageClassName,它将用于将 PersistentVolumeClaim 请求绑定到 PersistentVolume。
更新配置,持久卷:
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
storageClassName: manual
claimRef:
name: nfs-claim1
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
nfs:
path: /volume2/K8s_NFS
server: 172.16.66.50
persistentVolumeReclaimPolicy: Recycle
持久卷声明:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-claim1
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi