V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
henrywangx
V2EX  ›  问与答

k8s 的 pv 会爆掉吗

  •  
  •   henrywangx · 2019-05-01 09:54:45 +08:00 via iPhone · 4399 次点击
    这是一个创建于 1793 天前的主题,其中的信息可能已经有所发展或是发生改变。
    地铁上突然想起,如果累积大小超过 k8s 的 persistent volume 大小,pod 会怎么样?
    10 条回复    2019-11-15 11:19:07 +08:00
    ifaii
        1
    ifaii  
       2019-05-01 10:13:51 +08:00   ❤️ 1
    大小是由底层存储类型控制的,并不是 k8s 里面声明的,超过后只要底层卷没满就可以继续写
    henrywangx
        2
    henrywangx  
    OP
       2019-05-01 10:52:14 +08:00 via iPhone
    @ifaii 那 k8s 声明的大小意义何在呢?
    ifaii
        3
    ifaii  
       2019-05-01 11:08:38 +08:00
    @henrywangx #2 以我的理解经验是在使用 storageclass 动态创建 pvc 时声明需要创建的大小,这时候底层存储就分配给你这么大的一个卷
    iwishing
        4
    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
        5
    artandlol  
       2019-05-01 13:17:47 +08:00 via iPhone
    这问题有点傻傻的,满了,pod 自然就挂了
    henrywangx
        6
    henrywangx  
    OP
       2019-05-01 14:30:03 +08:00 via iPhone
    @artandlol sorry,事实上并没有挂掉...我没找到官方详细的描述,所以求问...
    henrywangx
        7
    henrywangx  
    OP
       2019-05-01 14:31:02 +08:00 via iPhone
    @iwishing 谢谢指教,我会再去看看文档和代码
    kaneg
        8
    kaneg  
       2019-05-01 18:15:20 +08:00 via iPhone
    对一般存储来说 kubernetes 根本不知道你的 PV 实际占用多大空间,只要你底层存储不会因为空间爆掉而出问题就行
    lingduhuanbing
        9
    lingduhuanbing  
       2019-11-15 09:40:38 +08:00
    确实不会爆掉,这个设定确实很奇怪。K8S 还提供了 PVC 扩容,如果还是根据底层存储的实际容量来,那直接扩底层存储就好了,为啥还要扩 PVC ?
    henrywangx
        10
    henrywangx  
    OP
       2019-11-15 11:19:07 +08:00 via iPhone
    @lingduhuanbing 这个就是个标签啦,可能最开始就是为公有云服务的,而且最近理解,k8s 就是 platform for platform,这些标签的背后行为还是由 devops 自己去管理
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1486 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:19 · PVG 01:19 · LAX 10:19 · JFK 13:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.