Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I delete a PV? #132

Closed
gertvdijk opened this issue Jul 18, 2019 · 3 comments
Closed

How do I delete a PV? #132

gertvdijk opened this issue Jul 18, 2019 · 3 comments

Comments

@gertvdijk
Copy link

gertvdijk commented Jul 18, 2019

After having used a volume before or created a storage class with a typo in the name, I'd like to remove the volumes from the list of available ones. I've failed doing so, it keeps being listed. Here's what I've tried:

  1. Unmount the volume on the node.
  2. Remove the volume directory on the node (as specified in the storageClassMap part of the ConfigMap; hostDir & mountDir do not exist any longer).
  3. Remove the whole storageClassMap entry in the ConfigMap.
  4. Remove the whole StorageClass object.
  5. Restart all pods in the daemonset for the provisioner.

Still lists my PVs as available with the age of the original creation time and a non-existing storageClass:

$ kubectl get pv
NAME                CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM                             STORAGECLASS            REASON   AGE
local-pv-21cd33fd   10015Mi    RWO            Delete           Available                                     my-sc-class-with-typo            52m
$ kubectl get sc/my-sc-class-with-typo
Error from server (NotFound): storageclasses.storage.k8s.io "my-sc-class-with-typo" not found

Is this intentional? I don't want a claim to be taken to those non-existing volumes.

I'm using 2.3.2 on Kubernetes 1.15.0.

(perhaps related: #6)

@cofyc
Copy link
Member

cofyc commented Jul 18, 2019

hi, PVs cannot be updated after creation. You must delete PV objects. You don't need to unmount volumes. If you want to fix the storage class name, you can follow the steps below:

  • delete DaemonSet to stop provisioners
  • delete the storage class and related PV objects
  • create the new storage class object
  • fix storageClassMap in the provisioner ConfigMap
  • deploy DaemonSet to run provisioners again

@gertvdijk
Copy link
Author

Thanks again for explaining. Not a bug then. When I feel more comfortable with the project I will consider to send a PR to improve the docs on it.

@cofyc
Copy link
Member

cofyc commented Jul 25, 2019

Welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants