开始设置的 PVC 空间偏小了,想调大一些,修改清单文件,部署时不让修改 PVC 的大小
通过下面的命令查看日志
kubectl logs -n clickhouse deployment/clickhouse-operator -c clickhouse-operator --since=5m
发现这样的错误
unable to Update PVC err: persistentvolumeclaims "data-volume-template-chi-clickhouse-db-analytics-0-0-0" is forbidden: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize
在 StorageClass 的清单文件中添加 allowVolumeExpansion
配置
allowVolumeExpansion: true
然后修改 PersistentVolume 的 capacity
spec:
capacity:
storage: 20Gi
最后修改 PersistentVolumeClaim 的 resources.requests.storage
spec:
resources:
requests:
storage: 20Gi
或者修改部署 clickhouse 的模板文件并更新部署
volumeClaimTemplates:
- name: data-volume-template
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
就可以了
参考:Out of Storage? How to Efficiently Resize PersistentVolumes