Extend VMware persistent volume in Kubernetes

How to extend VMware persistent volume (PV/PVC) with Kubernetes's VMwware in-tree driver ?

(using Rancher 2.5 with VMware/vSphere cloud provider, and Kubernetes 1.18)

I created a storageclass with the following UI options: Provider: VMWare vSphere Volume and Allow Volume Expansion : Enabled. (I had to re-edit the SC and click "Allow Volume Expansion : Enabled" again)

I created a PVC, started my pod, stopped the pod. Then I used the "resized" UI to increase the volume size (in Rancher > Cluster x > Project y > Resource > Workload > Volumes > menu button > Resize) The volume now has: spec.resources.requests.storage: 20Gi and status.capacity.storage: 10Gi (see yaml below)

But I get the error in Events:

ExternalExpanding   Ignoring the PVC: didn't find a plugin capable of expanding the volume; waiting for an external controller to process this PVC.

The Volume expansion seems to require an external-resizer Kubernetes CSI Sidecar Containers.


The stotageClass is :

#kubectl get storageclass -o yaml testsc 
allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: testsc 
parameters:
  datastore: TESTDS
  diskformat: thin
provisioner: kubernetes.io/vsphere-volume
reclaimPolicy: Delete

PVC

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: kubernetes.io/vsphere-volume
    volume.kubernetes.io/selected-node: testnode1
  finalizers:
  - kubernetes.io/pvc-protection
  name: testpvc
  namespace: test
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: testsc
  volumeMode: Filesystem
  volumeName: pvc-31d5f008-724a-4da3-b7ab-9bd2c067753e
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 10Gi
  phase: Bound

Kubernetes in-tree driver seems deprecated in favor of external CSI "drivers". Only few in-tree drivers supports volume expansion, vsphere/vmware is not listed. furthermore,

How to resize dynamic volumes once provisioned?

Support for resizing existing dynamic volume is not yet there. Proposal is available here. vSphere Cloud Provider does not support resize of volume. Please track this issue.

Extending volume is likely to require to use CSI driver instead of Kubernetes' in-tree Vsphere driver.

Rancher now document how to migrate do vsphere-volume-migration.

P.S. Vmware's Kubernetes Tanzu seems to allow to Expand a Persistent Volume doc... on VSAN maybe, because the bug 70616 states: PVC resizing is not yet supported in the VMware vSphere VMFS file system.