在 k8s 1.9 上扩展 statefulset 的大小 PVC

Expand size PVC of statefulset on k8s 1.9

我有一个有状态的kafka。我需要扩展磁盘大小,我尝试使用k8s 1.9的自动调整大小功能没有成功

此处:https://kubernetes.io/docs/concepts/storage/persistent-volumes/#expanding-persistent-volumes-claims

我确实激活了feature gates和admission plugging,我认为这是可行的,因为我可以在修改后成功改变pvc的大小。

但是什么都没发生,我已经将 PVC 的大小从 50Gi 修改为 250Gi。

pvc 中的容量确实发生了变化,但在 AWS 上 EBS 卷仍然是 50gb 并且 pod 中的 df -h 仍然显示 50gb

我错过了什么吗?我必须在 aws 上手动调整大小吗?

谢谢

这是一个 alpha 功能,存在一些问题和局限性。

尝试在 Github 上查找与您的问题相关的问题的一些信息:

此外,检查 comment,它可能有用:

@discordianfish please try EBS PVC resize with 1.10. Currently the user experience of resizing volumes with file systems is not ideal. You will have to edit the pvc and then wait for FileSystemResizePending condition to appear on PVC and then delete and recreate the pod that was using the PVC. If there was no pod using the PVC, then once condition FileSystemResizePending appears on PVC then you will have to start a pod using it for file system resize to finish.

我使这个功能起作用了,但是是以一种非常非常肮脏的方式。

  1. 修改PVC大小
  2. 手动修改EBS的大小
  3. 强制卸载 AWS 上的卷
  4. pod 崩溃并且是 由 statefullset 重新安排,当 pod 再次启动时,卷和分区具有正确的大小