以下在rook-ceph 1.4.2下实现
- 1、storageclass 设置 allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-ceph-block
provisioner: ceph.rook.io/block
reclaimPolicy: Retain
allowVolumeExpansion: true
parameters:
blockPool: replicapool
clusterNamespace: rook-ceph
fstype: xfs
- 2、编辑pvc增大容量 resources.requests.storage: 5G
kubectl edit -n base pvc minio
...
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: rook-ceph-block
volumeMode: Filesystem
volumeName: pvc-e39e8eed-391a-4357-ad33-8c7d87d3d305
...
3、扩展rdb
或者:
#进入toolbox
kubectl exec -it -n rook-ceph rook-ceph-tools-85b7cdfff8-wtd6s -- bash
#用rdb resize命令 size单位为MB
rbd resize --size 8192 --pool replicapool pvc-e39e8eed-391a-4357-ad33-8c7d87d3d305
扩展好后查看:
rbd info --pool replicapool pvc-e39e8eed-391a-4357-ad33-8c7d87d3d305
4、进入pod所在的主机
xfs存储 : xfs_growfs /dev/rbd1
ext存储: resize2fs /dev/rbd1
5、进入pod,查看是否容量扩大
kubectl exec -it -n base minio-664758d447-hx9kk -- sh
df -ah
6、遗留问题,PVC容量显示不正确