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

volume leak after CreateVolume started and before PV creation #486

Open
pohly opened this issue Sep 28, 2020 · 13 comments · May be fixed by #1179
Open

volume leak after CreateVolume started and before PV creation #486

pohly opened this issue Sep 28, 2020 · 13 comments · May be fixed by #1179
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@pohly
Copy link
Contributor

pohly commented Sep 28, 2020

In the following sequence of events a volume can leak:

  • external-provisioner issues a CreateVolume call for a PVC
  • external-provisioner is stopped before it creates the PV
  • the PVC is deleted
  • external-provisioner is restarted

That volume provisioning started is not recorded anywhere, so the restarted external-provisioner doesn't know that it needs to continue with it.

@pohly
Copy link
Contributor Author

pohly commented Sep 28, 2020

One possible solution is to set a finalizer for the PVC before issuing the CreateVolume call and removing it after creating the PV.

@pohly
Copy link
Contributor Author

pohly commented Sep 28, 2020

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 28, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 27, 2020
@pohly
Copy link
Contributor Author

pohly commented Dec 27, 2020

/remove-lifecycle stale
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 27, 2020
@bertinatto
Copy link
Contributor

/assign

@bertinatto
Copy link
Contributor

/remove-lifecycle stale

@BroYongVeryBusy
Copy link

One possible solution is to set a finalizer for the PVC before issuing the CreateVolume call and removing it after creating the PV.

I have a question:
If user delete finalizer by "kubelet edit pvc ”, this method is useless.

@pohly
Copy link
Contributor Author

pohly commented Nov 23, 2021

There's no perfect protection against user mistakes. If a user force-deletes or removes finalizers, they need to be aware that they are working against the system and accept the consequences.

@BroYongVeryBusy
Copy link

There's no perfect protection against user mistakes. If a user force-deletes or removes finalizers, they need to be aware that they are working against the system and accept the consequences.

however,if user and storage provisioner are on different side.
user can use this,to make storage provisioner to get volume leak.

@pohly
Copy link
Contributor Author

pohly commented Nov 23, 2021

Isn't the storage provisioner charging the user for such a leaked volume?

If they can't do that, then they shouldn't grant their untrusted users the permission to create or modify PVCs.

@koct9i
Copy link

koct9i commented Mar 24, 2023

I've just found monstrous kludge in openebs lvm-localpv for this issue.

For more robust protection against race provisioner could create stub PV before calling CreateVolume. There is PV state for that: Phase=Pending. But pv_controller does not respect this phase and will try to bind PVC to unready PV. Or probably I've read state machine in wrong way.

Also, provisioner could report leaked volumes in some way. Maybe even create PV for them.
For example, "external-health-monitoring" could easily detect unknown volumes in output of ListVolumes.

@Madhu-1
Copy link
Contributor

Madhu-1 commented Sep 12, 2023

Do we have any fix for this issue?

I have hit this problem with clones. if the PVC is deleted when the clone is in progress and the volume snapshot is also deleted, if there is any provisioner restart DeleteVolume will never get called, and also snapshot cannot be deleted if a driver doesn't support snapshot deletion when the clone is created from the snapshot.

@msau42 @xing-yang @pohly ^^

@msau42
Copy link
Collaborator

msau42 commented Sep 12, 2023

I think it would be some significant amount of API complexity to support a stub PV. Maybe we can explore something with CRDs. @jsafrane wdyt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
8 participants