K8S 扩容storageclass类型的PVC
扩容之前最好先取消挂载,(处于挂载状态能否扩容没试过)先查看storageclass是否配置了允许动态扩容,看storageclass是否存在allowVolumeExpansion字段并且值为true。一般云厂商提供的storageclass都是允许动态扩容的。#kubectl get storageclass default -o yamlallowVolumeExpansion: true查
·
扩容之前最好先取消挂载,(处于挂载状态能否扩容没试过)
以下配置方法在阿里云/Azure云 验证过
-
先查看storageclass是否配置了允许动态扩容,看storageclass是否存在allowVolumeExpansion字段并且值为true。
一般云厂商提供的storageclass都是允许动态扩容的。#kubectl get storageclass default -o yaml allowVolumeExpansion: true
-
查看谁在使用要扩容的pv,查看pvc的状态
#kubectl get pv #kubectl -n harbor get pvc
-
获取pvc的yaml(或者直接编辑pvc的配置 kubectl -n harbor edit pvc harbor-harbor-registry 修改storage: 200Gi的大小)
# kubectl -n harbor get pvc harbor-harbor-registry -o yaml > harbor-harbor-registry-pvc.yaml
-
修改yaml文件,调整pvc大小,比如由原来的50G调整到200Gi
``` spec: accessModes: - ReadWriteOnce resources: requests: storage: 200Gi storageClassName: managed-premium volumeMode: Filesystem volumeName: pvc-12de06a7-38f0-41d3-a35f-26324a91fc32 ```
-
停止使用pvc的pod
#kubectl -n harbor scale deployment/harbor-harbor-registry --replicas=0
-
应用新的调整后的yaml文件
#kubectl -n harbor apply -f harbor-harbor-registry-pvc.yaml
-
启动pod
#kubectl -n harbor scale deployment/harbor-harbor-registry --replicas=1
扩容完成,验证。
更多推荐
已为社区贡献15条内容
所有评论(0)