【问题标题】:Strimzi cant resize PVStrimzi 无法调整 PV 的大小
【发布时间】:2021-11-29 18:47:09
【问题描述】:

我跟着 Strimzi blog 调整 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(K8s v1.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>

我尝试使用 oc scale replicas=0 sts/XX-dev 将 reaplica 缩小到 0,但由于复制因素,cluster-operator 不允许。

【问题讨论】:

  • 并非所有存储类型和存储驱动程序都支持调整大小。所以这里可能不支持?
  • 您能否尝试删除正在使用此 pvc 的 pod 以使其重新创建,然后检查 PVC 大小是否增加。

标签: azure kubernetes apache-kafka strimzi


【解决方案1】:

NormallyAzure Disk 支持调整 Persistent Volumes 的大小,但目前在合规性和实现方面存在一些问题check here

所以在去任何其他地方之前;只需再检查一次以下几点

  • 如果 allowVolumeExpansion 设置为 true,请使用“storageClassName: generic”检查存储类定义。 (可能您之前尝试过使用不同的存储类调整大小)You can only expand a PVC if its storage class's allowVolumeExpansion field is set to true.
  • 看起来您需要先取消分配指向该卷的所有内容(检查 https://docs.microsoft.com/en-us/azure/aks/azure-disk-csi 的警告),然后调整 Pod 的大小,最后缩小 Pod。
  • 尝试通过乘法递增检查此处的大小(https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types)
  • 可能会达到每个 VM 的卷限制,default is 16 对于 Azure,暂时检查您现在在该节点中有多少卷

另一个问题是,如果基础容量不足以调整大小,则必须在新资源组中解除分配和重新定位 VM。是的,云不是无限的

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-24
    • 2018-12-11
    • 2020-09-25
    • 2012-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多