简体   繁体   English

有没有一种方法可以在kubernetes部署(或有状态集)中为每个Pod创建持久卷?

[英]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. 我当前正在创建kubernetes部署,在此部署中,我在X处设置了副本值,我想创建X卷,当相应的pod重新启动时,该卷不为空。 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... 我一直在kubernetes doc中搜索答案,而我的第一个尝试是创建绑定到pv的每个Pod的一个巨大的持久卷和一个持久卷请求,但似乎不起作用...

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. 我的期望是使X的卷在各个吊舱之间不共享,并且当吊舱由于活动性探测而被杀死时不会消失。 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. StatefulSet可以定义volumeClaimTemplates ,这意味着每个副本一个或多个独立的卷。 For that to work StorageClass must be capable of dynamic volume provisioning. 为此,StorageClass必须能够动态卷配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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