Is there a way to create a persistent volume per pod in a kubernetes deployment (or statefulset)?

生来就可爱ヽ(ⅴ<●) 提交于 2020-05-16 03:43:09

问题


I'm currently creating a kubernetes deployment, in this deployment I have replicas value set at X and I want to create X volume that are not empty when the corresponding pod is restarted. I'm not using any cloud provider infrastructures then please avoid command using cloud services.

I've been searching answer in kubernetes doc, and my first try was to create one huge persistent volume and one persistant volume claim per pod that are bind to the pv but it's seem's to not work...

My expectations are to have X volumes that are not shared between pods and that are not dying when pod is killed because of a liveness probe. I'm aware of any possibilities that can do the trick!


回答1:


Deployment replicas all use the same volume. There is no possibility currently to create independent volumes per replica.

StatefulSets can define volumeClaimTemplates which means one or more independent volumes per replica. For that to work StorageClass must be capable of dynamic volume provisioning.



来源:https://stackoverflow.com/questions/55807162/is-there-a-way-to-create-a-persistent-volume-per-pod-in-a-kubernetes-deployment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!