Kubernetes - PVC / PV
Primitives: PersistentVolumeClaim
, PersistentVolume
, StorageClass
, VolumeSnapshot
(requires CSI driver support).
Kubernetes supports two volumeModes of PersistentVolumes: Filesystem (default) and Block.
PVC in "Lost" Status
If you delete a PV, the coresponding PVC status will be changed from Bound
to Lost
.
If a PVC is in lost state, try to delete this PVC's annoation, it will make the PVC rebind:
"annotations": {
"pv.kubernetes.io/bind-completed": "yes"
},
PV in "Released" Status
If PV is stuck in Released
Status, remove the .spec.claimRef
=> PV should change to "Available", then it may be "Bound"
Relationships
StorageClass
- (.provisioner
) -> CSI driverPVC
- (.spec.storageClassName
) ->StorageClass
POD
- (.spec.values[].persistentVolumeClaim
) ->PVC
kind: StorageClass
provisioner: csi-driver.example.com
Pod to PVC:
kind: Pod
spec:
volumes:
- name: foo
persistentVolumeClaim:
claimName: my-request-for-storage