Difference between revisions of "Kubernetes Persistent Volume Claim (PVC)"

From wikieduonline
Jump to navigation Jump to search
 
(47 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
+
* https://kubernetes.io/docs/concepts/storage/persistent-volumes/
{{PVC types}}
 
 
 
  
 
* <code>[[kubectl get pvc]]</code>
 
* <code>[[kubectl get pvc]]</code>
 +
* <code>[[kubectl get pvc -o yaml]]</code>
 
* <code>[[kubectl describe pvc]] mysql-pv-claim</code>
 
* <code>[[kubectl describe pvc]] mysql-pv-claim</code>
 
* <code>[[kubectl describe pvc grafana]]</code>
 
* <code>[[kubectl describe pvc grafana]]</code>
 +
* <code>[[kubectl patch pvc]]</code>
  
 +
[[kind: PersistentVolumeClaim]]
 +
[[kind: PersistentVolume]]
 +
[[kind: StorageClass]]
  
 
  error: persistentvolumeclaims "your-elasticsearch-master-0" could not be patched: persistentvolumeclaims "your-elasticsearch-master-0" is forbidden: [[only dynamically provisioned pvc]] can be [[resized]] and the [[storageclass]] that provisions the pvc must support resize.
 
  error: persistentvolumeclaims "your-elasticsearch-master-0" could not be patched: persistentvolumeclaims "your-elasticsearch-master-0" is forbidden: [[only dynamically provisioned pvc]] can be [[resized]] and the [[storageclass]] that provisions the pvc must support resize.
  
 +
[[ProvisioningFailed]]
 +
 +
== PVC types ==
 +
{{PVC types}}
 +
 +
== Examples ==
 +
[[Volume expansion]]
 +
{{PVC expansion}}
 +
 +
[[kubectl apply -f your_new_pvc.yml]]
 +
persistentvolumeclaim/myclaim created
 +
 +
 +
[[kubectl describe pvc]] yourpv
 +
{{kubectl describe pvc example}}
 +
 +
== Errors ==
 +
* <code>[[FailedScheduling]] .../... [[Pod has unbound immediate PersistentVolumeClaims]]</code>
 +
* Warning  ClaimLost          [[persistentvolumeclaim/]]yourclaim  [[Bound claim has lost reference to PersistentVolume]]. Data on the volume is lost!          [[Cluster has no ready nodes.]]
 +
* <code>0/7 nodes are available: 7 [[pod has unbound immediate PersistentVolumeClaims]]</code>
  
 +
== News ==
 +
* [[K8s v1.31]] Aug 2024 Changes to reclaim policy for PersistentVolumes
  
 
== Related terms ==
 
== Related terms ==
* <code>[[kind]]: [[PersistentVolume]]</code>
+
* [[Kubernetes Persistent Volumes (PV)]]: <code>[[kind]]: [[PersistentVolume]]</code>
 
* <code>[[kind: StorageClass]]</code>
 
* <code>[[kind: StorageClass]]</code>
* <code>[[kubectl create]]</code>
 
 
* <code>[[kubectl describe deployment]]  | grep [[PersistentVolumeClaim]]</code>
 
* <code>[[kubectl describe deployment]]  | grep [[PersistentVolumeClaim]]</code>
 
* <code>[[aws ec2 describe-volumes]] | [[grep -A1]] Name</code>
 
* <code>[[aws ec2 describe-volumes]] | [[grep -A1]] Name</code>
 
* <code>[[awsElasticBlockStore]]</code>
 
* <code>[[awsElasticBlockStore]]</code>
 
* <code>[[kubectl get volumesnapshot]]</code>
 
* <code>[[kubectl get volumesnapshot]]</code>
 +
* [[K8up Kubernetes Backup Operator]]
 +
* <code>[[kind: Provisioner]]</code>
 +
* <code>[[volumes:]]</code>
 +
* [[Kubernetes HostPath volume provider]]
 +
* [[Data on Kubernetes Community (DoKC)]]
 +
* [[DiskPressure]]
 +
* [[persistentvolumeclaim]] "yourpvname" [[not found]].
 +
* [[Kubernetes Finalizers]]
  
 
== Activities ==
 
== Activities ==
 
* [[CKA v1.23]]: [[Understand persistent volume claims primitive]]
 
* [[CKA v1.23]]: [[Understand persistent volume claims primitive]]
* [[CKA v1.18]]: [[Understand persistent volumes and know how to create them]]
+
* [[Create a PersistentVolumeClaim]]
* [[CKA v1.15]]: [[Understand PersistentVolumeClaims (PVC) for storage]]
+
* [[Create a new volume using: kind: PersistentVolumeClaim]]
 +
 
 +
* Read https://cloud.google.com/kubernetes-engine/docs/concepts/persistent-volumes
  
 
== See also ==
 
== See also ==
* {{Kubernetes storage}}
+
* {{PVC}}
 
+
* {{DoKC}}
  
[[Category:Kubernetes]]
+
[[Category:K8s]]

Latest revision as of 14:51, 12 September 2024

kind: PersistentVolumeClaim
kind: PersistentVolume
kind: StorageClass
error: persistentvolumeclaims "your-elasticsearch-master-0" could not be patched: persistentvolumeclaims "your-elasticsearch-master-0" is forbidden: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize.
ProvisioningFailed

PVC types[edit]

Examples[edit]

Volume expansion

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: myclaim
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi # specify new size here
kubectl apply -f your_new_pvc.yml
persistentvolumeclaim/myclaim created


kubectl describe pvc yourpv
 apiVersion: v1
kind: PersistentVolumeClaim
metadata:
 annotations:
   pv.kubernetes.io/bind-completed: "yes"
   pv.kubernetes.io/bound-by-controller: "yes"
   volume.beta.kubernetes.io/storage-provisioner: example.com/aws-efs
 creationTimestamp: "2022-10-27T15:10:12Z"
 finalizers:
 - kubernetes.io/pvc-protection
 managedFields:
 ...
   manager: kube-controller-manager
   operation: Update
   time: "2022-10-27T15:10:13Z"
 name: yourpv
 namespace: mynamespace
 resourceVersion: "719208361"
 [[selfLink: /api/v1/namespaces/mynamespace/persistentvolumeclaims/myvoy
 uid: b3295ba0-0000-123-123-1234567
spec:
 accessModes:
 - ReadWriteOnce
 resources:
   requests:
     storage: 5Gi
 storageClassName: efs
 volumeMode: Filesystem
 volumeName: pvc-1234-1234-1234-1234-123456789
status:
 accessModes:
 - ReadWriteOnce
 capacity:
   storage: 5Gi
 phase: Bound

Errors[edit]

News[edit]

  • K8s v1.31 Aug 2024 Changes to reclaim policy for PersistentVolumes

Related terms[edit]

Activities[edit]

See also[edit]

Advertising: