有没有一种方法可以在kubernetes部署(或有状态集)中为每个Pod创建持久卷? [英] Is there a way to create a persistent volume per pod in a kubernetes deployment (or statefulset)?

查看:77
本文介绍了有没有一种方法可以在kubernetes部署(或有状态集)中为每个Pod创建持久卷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在创建一个kubernetes部署,在此部署中,我将副本值设置为X,并且我想创建X卷,当相应的pod重新启动时,该卷不为空. 我没有使用任何云提供商的基础架构,所以请避免使用云服务来命令.

我一直在kubernetes doc中搜索答案,而我的第一个尝试是创建绑定到pv的每个pod的一个巨大的持久卷和一个持久卷声明,但这似乎不起作用...

我的期望是使X的卷在各个吊舱之间不共享,并且当吊舱由于活动性探测而被杀死时不会死亡. 我知道可以解决这个问题的任何可能性!

解决方案

部署副本均使用相同的卷.当前不可能为每个副本创建独立的卷.

StatefulSet可以定义 volumeClaimTemplates ,这意味着一个或多个独立每个副本的卷.为此,StorageClass必须具有动态卷配置功能.<​​/p>

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.

这篇关于有没有一种方法可以在kubernetes部署(或有状态集)中为每个Pod创建持久卷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆