k8s 的 pv 会爆掉吗

2019-05-01 09:54:45 +08:00
 henrywangx
地铁上突然想起,如果累积大小超过 k8s 的 persistent volume 大小,pod 会怎么样?
4433 次点击
所在节点    问与答
10 条回复
ifaii
2019-05-01 10:13:51 +08:00
大小是由底层存储类型控制的,并不是 k8s 里面声明的,超过后只要底层卷没满就可以继续写
henrywangx
2019-05-01 10:52:14 +08:00
@ifaii 那 k8s 声明的大小意义何在呢?
ifaii
2019-05-01 11:08:38 +08:00
@henrywangx #2 以我的理解经验是在使用 storageclass 动态创建 pvc 时声明需要创建的大小,这时候底层存储就分配给你这么大的一个卷
iwishing
2019-05-01 12:20:34 +08:00
https://github.com/kubernetes/kubernetes/issues/48701

this is working as intended, kube can't/won't enforce the capacity of PVs, the capacity field on PVs is just a label. It's up to the "administrator" i.e. the creator of the PV to label it accurately so that when users create PVCs that needs >= X Gi, they get what they want.

For a hostPath PV, assigning a capacity may be difficult when the user can use as much free space as there is at that host path, but for e.g. EBS you can of course make capacity match the actual disk size.

声明的意义在于 pvc 去匹配 pv (手动狗头)
artandlol
2019-05-01 13:17:47 +08:00
这问题有点傻傻的,满了,pod 自然就挂了
henrywangx
2019-05-01 14:30:03 +08:00
@artandlol sorry,事实上并没有挂掉...我没找到官方详细的描述,所以求问...
henrywangx
2019-05-01 14:31:02 +08:00
@iwishing 谢谢指教,我会再去看看文档和代码
kaneg
2019-05-01 18:15:20 +08:00
对一般存储来说 kubernetes 根本不知道你的 PV 实际占用多大空间,只要你底层存储不会因为空间爆掉而出问题就行
lingduhuanbing
2019-11-15 09:40:38 +08:00
确实不会爆掉,这个设定确实很奇怪。K8S 还提供了 PVC 扩容,如果还是根据底层存储的实际容量来,那直接扩底层存储就好了,为啥还要扩 PVC ?
henrywangx
2019-11-15 11:19:07 +08:00
@lingduhuanbing 这个就是个标签啦,可能最开始就是为公有云服务的,而且最近理解,k8s 就是 platform for platform,这些标签的背后行为还是由 devops 自己去管理

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/560298

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX