How to bound PV with PVC - cniackz/public GitHub Wiki
Things I recommend checking:
- Capacity must be same:
capacity
I have requested 1 TiB but PV is 100 GiB only, this wouldn't work
accessModes
must match.
- If
claimRef
does not work, use storageClassName
in PV and should match with the PVC storageClassName
in this case cesar
.
On PVC:
spec:
volumeName: pv0002
On PV:
spec:
claimRef:
kind: PersistentVolumeClaim
namespace: default
name: data0-ket-tenant-pool-0-0
PV:
kind: PersistentVolume
apiVersion: v1
metadata:
name: pv0002
uid: 800890dc-6cb3-4d89-b9fe-de03e09c2df7
resourceVersion: '38122'
creationTimestamp: '2022-10-06T05:45:19Z'
labels:
volume: pv0002
finalizers:
- kubernetes.io/pv-protection
managedFields:
- manager: kube-controller-manager
operation: Update
apiVersion: v1
time: '2022-10-06T05:45:19Z'
fieldsType: FieldsV1
fieldsV1:
'f:status':
'f:phase': {}
subresource: status
- manager: kubectl-create
operation: Update
apiVersion: v1
time: '2022-10-06T05:45:19Z'
fieldsType: FieldsV1
fieldsV1:
'f:metadata':
'f:labels':
.: {}
'f:volume': {}
'f:spec':
'f:capacity': {}
'f:hostPath':
.: {}
'f:path': {}
'f:type': {}
'f:persistentVolumeReclaimPolicy': {}
'f:volumeMode': {}
- manager: Mozilla
operation: Update
apiVersion: v1
time: '2022-11-02T21:14:06Z'
fieldsType: FieldsV1
fieldsV1:
'f:spec':
'f:accessModes': {}
'f:capacity':
'f:storage': {}
'f:storageClassName': {}
- manager: kube-controller-manager
operation: Update
apiVersion: v1
time: '2022-11-02T21:14:18Z'
fieldsType: FieldsV1
fieldsV1:
'f:spec':
'f:claimRef': {}
spec:
capacity:
storage: '1099511627776'
hostPath:
path: /mnt/pv-data/pv0002
type: ''
accessModes:
- ReadWriteOnce
claimRef:
kind: PersistentVolumeClaim
namespace: cesar
name: data0-cesar-pool-0-0
uid: 4812cfba-26a5-4450-a46f-27ce6b5894fc
apiVersion: v1
resourceVersion: '36451'
persistentVolumeReclaimPolicy: Recycle
storageClassName: cesar
volumeMode: Filesystem
status:
phase: Bound
PVC:
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
annotations:
pv.kubernetes.io/bind-completed: 'yes'
pv.kubernetes.io/bound-by-controller: 'yes'
resourceVersion: '38125'
name: data0-cesar-pool-0-0
uid: 4812cfba-26a5-4450-a46f-27ce6b5894fc
creationTimestamp: '2022-11-02T21:06:35Z'
managedFields:
- manager: kube-controller-manager
operation: Update
apiVersion: v1
time: '2022-11-02T21:14:18Z'
fieldsType: FieldsV1
fieldsV1:
'f:metadata':
'f:annotations':
.: {}
'f:pv.kubernetes.io/bind-completed': {}
'f:pv.kubernetes.io/bound-by-controller': {}
'f:labels':
.: {}
'f:v1.min.io/console': {}
'f:v1.min.io/pool': {}
'f:v1.min.io/tenant': {}
'f:spec':
'f:accessModes': {}
'f:resources':
'f:requests':
.: {}
'f:storage': {}
'f:storageClassName': {}
'f:volumeMode': {}
'f:volumeName': {}
- manager: kube-controller-manager
operation: Update
apiVersion: v1
time: '2022-11-02T21:14:18Z'
fieldsType: FieldsV1
fieldsV1:
'f:status':
'f:accessModes': {}
'f:capacity':
.: {}
'f:storage': {}
'f:phase': {}
subresource: status
namespace: cesar
finalizers:
- kubernetes.io/pvc-protection
labels:
v1.min.io/console: cesar-console
v1.min.io/pool: pool-0
v1.min.io/tenant: cesar
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: '1099511627776'
volumeName: pv0002
storageClassName: cesar
volumeMode: Filesystem
status:
phase: Bound
accessModes:
- ReadWriteOnce
capacity:
storage: '1099511627776'