我跟着 Strimzi博客调整 PV 的大小。
我使用部署在 Azure VM 上的 Openshift v3.11
,并将 PV 作为 Azure 托管磁盘
我的 Kafka 集群存储配置
..
config:
offsets.topic.replication.factor: 2
transaction.state.log.replication.factor: 1
transaction.state.log.min.isr: 1
log.message.format.version: "2.6"
storage:
type: persistent-claim
size: 256Gi
deleteClaim: false
...
我直接编辑pvc,把资源请求改成257Gi。我等了几分钟,检查 PVC 的状态,比如吹
oc get pvc data-0-xx-dev-kafka-0 -o yaml
apiVersion: v1
kind: PersistentVolumeClaim
...
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 257Gi
storageClassName: generic
volumeName: pvc-xx-2849-xx-913f-xx
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 256Gi
conditions:
- lastProbeTime: null
lastTransitionTime: 2021-10-08T15:54:06Z
status: "True"
type: Resizing
phase: Bound
在 pvc 的描述中,我在下面看到
Warning VolumeResizeFailed 3s (x2 over 1m) volume_expand Error expanding volume "kafka/data-0-sirius-dev-kafka-0" of plugin kubernetes.io/azure-disk : compute.DisksClient#CreateOrUpdate:
Failure sending request: StatusCode=409 -- Original Error: failed request: autorest/azure:
Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Cannot resize disk kubernetes-dynamic-pvc-xx-2849-xx-913f-xx while it is
attached to running VM /subscriptions/xxxx/resourceGroups/xxx-dev-openshift/providers/Microsoft.Compute/virtualMachines/ocp-node-dev-1. Resizing a disk of an Azure Virtual Machine requires the virtual machine to be deallocated.
Please stop your VM and retry the operation."
我也尝试过,jbod
用单个磁盘重新部署 kafka,调整大小并进行滚动更新。与上面相同的结果
- openshift
v3.11.0+cbab8ee-94
(K8sv1.11.0+d4cacc0
) - 卡夫卡版本:
2.6.0
- 运营商:
0.20.1
请注意,我的集群中确实支持调整 PV 大小(以前我通过将副本缩小到零成功地调整了应用程序的 PV 大小)
更新
$ oc describe storageclass generic
Name: generic
IsDefaultClass: Yes
Annotations: storageclass.beta.kubernetes.io/is-default-class=true
Provisioner: kubernetes.io/azure-disk
Parameters: kind=managed,location=${location},storageaccounttype=Premium_LRS
AllowVolumeExpansion: True
MountOptions:
discard
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>
我尝试使用 将 reaplica 缩小到 0 oc scale replicas=0 sts/XX-dev
,但cluster-operator
由于复制因素而不允许。