K8S storage e2e experiment under VMware vSphere

Environment

root@4201c9358d96fda3a30840a3e7cc9795 [ ~ ]# kubectl version
Client Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.3-beta.0.15+93d6c59069f682", GitCommit:"93d6c59069f6824fb05e926ea094966b47ed8b28", GitTreeState:"clean", BuildDate:"2019-08-15T03:43:36Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.3-beta.0.15+93d6c59069f682", GitCommit:"93d6c59069f6824fb05e926ea094966b47ed8b28", GitTreeState:"clean", BuildDate:"2019-08-15T03:38:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}

And my K8S cluster is running on VMware PKS.

E2E steps

  • Create StorageClass

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: wcpglobal-storage-profile
parameters:
  storagePolicyID: eb806c5f-f214-4f34-9fa8-5387020354ea
provisioner: csi.vsphere.vmware.com
reclaimPolicy: Delete
volumeBindingMode: Immediate

You have to make sure your storagePolicyID has been created before from the vSphere UI, otherwise the provisioner won't work in terms of the dynamic provisioning

After you do kubectl apply to create the StorageClass, you will see the following:

  • Create PersistentVolumeClaim

After you do kubectl apply above yaml, you should be able to see the following details after a while(The status of your PVC might show Pending for a while):

  • Create Pod

After you apply above yaml. your pod will be under pending status for a while, that is because the dynamic provisioning is trying to provision a volume for you. It might take some time depends on the Storage Provider.

After a while, your pod should be up and running:

  • You should see PV gets created automatically

What if the StorageClass gets deleted, what will happen to those Pods, PV, PVC ?

  • I have the following running now:

  • Let me try to delete storage class, which is successfully deleted.

  • Surprisingly, the pod, pvc, pv are still there

  • kubectl exec into the demo pod, you will see you still have 5Gi capacity under the filesystem as you claimed from PVC:

  • Now, if you try to create another PVC by using the same storageclass, your PVC status will be under Pending.

  • If you re-create the StorageClass you just deleted, the PVC status will be changed to Bound after a while.

Conclusion: If you delete the storageclass, it will not affect your running Pod, PV, PVC. They will be still up and running. But you will not be able to create a new PVC by using the storageclass name you just deleted.

What will happen if I delete the PVC while a Pod is referencing to it ?

  • When I try to delete PVC, it seems get stuck(the terminal never returns):

  • Now, I delete the Pod which is succeeded, and the PVC is deleted as well

Conclusion: If a Pod is still using the PVC, the PVC could not be deleted, it will under terminating status forever until you have the Pod deleted.

Last updated

Was this helpful?