简体   繁体   中英

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

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM