Search code examples
kuberneteskubernetes-pvc

kubernetes expanding pvc for cluster


I have a pvc on my cluster.

I can expand it on my provider (digital ocean)

but then on the cluster do I need to somehow let it know that it expanded?

here is my file that I deployed to enable the creation of the pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: test-pvc
  namespace: test
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 4Gi
  storageClassName: do-block-storage

Solution

  • Resizing volumes other than through the PVC object (e.g., the DigitalOcean cloud control panel) is not recommended as this can potentially cause conflicts. Additionally, size updates will not be reflected in the PVC object status section immediately, and the section will eventually show the actual volume capacity

    The recommendation is to update the capacity through the PVC object using kubectl edit and the CSI Driver will update the volume by calling digital ocean API. From the docs

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: csi-pvc
      namespace: default
    spec:
      [...]
      resources:
        requests:
          # The field below can be increased.
          storage: 10Gi
          [...]
    

    After successful expansion, the status section of the PVC object will reflect the actual volume capacity.