k8s pvc 扩容方法

1storageclass 设置allowVolumeExpansion: true

如:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: rook-block
provisioner: rook.io/block
allowVolumeExpansion: true
parameters:
pool: replicapool
# Specify the namespace of the rook cluster from which to create volumes.
# If not specified, it will use `rook` as the default namespace of the cluster.
# This is also the namespace where the cluster will be
clusterNamespace: rook
# Specify the filesystem type of the volume. If not specified, it will use `ext4`.
# fstype: ext4

 

2编辑pvc增大容量

3扩展rdb

用rdb resize命令

如:

rbd resize --size 9192 pvc-6a06fa0f-c0a5-401b-83bf-d44c1dd20d80

扩展好后查看:

 rbd info --pool replicapool2 pvc-6a06fa0f-c0a5-401b-83bf-d44c1dd20d80   

4进入pod所在的主机

执行:resize2fs

如: resize2fs /dev/rbd1   

5进入pod,查看是否容量扩大

你可能感兴趣的:(kubernetes)