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

Specify if a pvc should be pod-level or deployment level? #58176

Closed
huang-jy opened this Issue Jan 11, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@huang-jy

huang-jy commented Jan 11, 2018

When dynamically creating a pvc and then referencing it from within a deployment, this claim becomes global across the deployment. So if I increase the deployment to more than one pod, everything from pod no. 2 onwards will fail as it the other pods will also attempt to claim the volume, but will be unable to do.

I want to be able to dynamically create a pv per pod, so that it provisions and tears down the disk as the pod is created and destroyed.

Is this currently possible? Or is it a feature request?

@mlmhl

This comment has been minimized.

Show comment
Hide comment
@mlmhl

mlmhl Jan 13, 2018

Contributor

Deployment doesn't support this feature right now, maybe StatefulSet can satisfy your demand, it will create PV for each pod.

Contributor

mlmhl commented Jan 13, 2018

Deployment doesn't support this feature right now, maybe StatefulSet can satisfy your demand, it will create PV for each pod.

@huang-jy

This comment has been minimized.

Show comment
Hide comment
@huang-jy

huang-jy Jan 13, 2018

I took a look at that, but I cannot get it to work. For example, using the example provided on the documentation

https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/

and

https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/

I get the following:

service "nginx" created
Error from server (BadRequest): error when creating "statefulsets.yaml": StatefulSet in version "v1" cannot be handled as a StatefulSet: no kind "StatefulSet" is registered for version "apps/v1"

(I then have to delete the nginx service )

Is there something I need to add or apply to the cluster to get StatefulSets working?

huang-jy commented Jan 13, 2018

I took a look at that, but I cannot get it to work. For example, using the example provided on the documentation

https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/

and

https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/

I get the following:

service "nginx" created
Error from server (BadRequest): error when creating "statefulsets.yaml": StatefulSet in version "v1" cannot be handled as a StatefulSet: no kind "StatefulSet" is registered for version "apps/v1"

(I then have to delete the nginx service )

Is there something I need to add or apply to the cluster to get StatefulSets working?

@huang-jy

This comment has been minimized.

Show comment
Hide comment
@huang-jy

huang-jy Jan 13, 2018

Had to change top of the yaml to

apiVersion: apps/v1beta2

But it seems to work now.

I'm noticing that it is not deleting the pvcs and pvs if I delete the sts - so if I create a sts, it will create the pvc and pv for the first pod as expected. If I scale up it will create pvc and pv for that one, but if I delete the sts entirely, all the pvcs and pvs are not deleted. is this intended?

huang-jy commented Jan 13, 2018

Had to change top of the yaml to

apiVersion: apps/v1beta2

But it seems to work now.

I'm noticing that it is not deleting the pvcs and pvs if I delete the sts - so if I create a sts, it will create the pvc and pv for the first pod as expected. If I scale up it will create pvc and pv for that one, but if I delete the sts entirely, all the pvcs and pvs are not deleted. is this intended?

@mlmhl

This comment has been minimized.

Show comment
Hide comment
@mlmhl

mlmhl Jan 13, 2018

Contributor

Yeah, this is intended, you need to delete all PVCs manually after pods or sts deleted.

Contributor

mlmhl commented Jan 13, 2018

Yeah, this is intended, you need to delete all PVCs manually after pods or sts deleted.

@huang-jy

This comment has been minimized.

Show comment
Hide comment
@huang-jy

huang-jy Jan 13, 2018

It makes sense, I guess -- if I was to recreate the sts, it would reattach to the same pvcs right?

huang-jy commented Jan 13, 2018

It makes sense, I guess -- if I was to recreate the sts, it would reattach to the same pvcs right?

@fejta-bot

This comment has been minimized.

Show comment
Hide comment
@fejta-bot

fejta-bot Apr 13, 2018

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

fejta-bot commented Apr 13, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment