pvcCleanup command

Last Updated : Nov 16, 2021 |
You can use the pvcCleanup command in a VMware vCenter deployment.
Prolog information

Command conditions

The pvcCleanup command finds PVCs that are in one of the following conditions, which prevent pods from launching.
  • Kubelet cannot mount the PVC. The associated virtual machine disk is in the Locked state on the VMware datastore.
  • Kubelet tries to create a PVC, but vCenter indicates that the virtual machine disk with the PVC name already exists.

Usage options

You can run this command as follows:
pvcCleanup --unlock-pvc | --delete-pvc | --recover-vmdk | --delete-failed-pvs | –-review | --help
The following table provides a description of each option:
Option
Description
--unlock-pvc
Unlocks all PVCs that vCenter sees as attached to a virtual machine, but the PVCs are not mounted on the virtual machine.
--delete-pvc
Deletes PVCs for which Kubernetes does not have a record, but that vCenter sees as present.
--recover-vmdk
Creates or recovers the VMDK.
If your docker registry is lost, you can run pvcCleanup --recover-vmdk to create a new VMDK, but the VMDK will not have any docker images. Run the ccm registry repopulate command to repopulate the docker image registry with docker images.
--delete-failed-pvs
Deletes all PVs that are in a Failed state from the Kubernetes cluster.
–-review
Lists PVCs that vCenter sees as attached to a virtual machine, but the PVCs are not mounted on the virtual machine.
--help
Displays help information.