tencent cloud

Feedback

Avoid attaching cloud disk across availability zones through cbs-csi

Last updated: 2022-03-23 18:17:29

    Overview

    CBS cloud disks do not support cross-AZ mounting to nodes. Therefore, in cross-AZ clusters, we recommend that you use the CBS-CSI topology awareness feature to avoid cross-AZ mounting problems.

    How it works

    Topology-aware scheduling requires the cooperation of multiple Kubernetes components, including the Scheduler, PV controller, and external-provisioner. The detailed process is as follows:

    1. The PV controller observes PVC objects and checks whether VolumeBindingMode of the Storageclass is WaitForFirstConsumer. If yes, it does not process the PVC creation event but waits for the Scheduler to process it.
    2. After the Scheduler schedules the pod, it will mark the nodeName on the PVC object as an annotation: volume.kubernetes.io/selected-node: 10.0.0.72.
    3. After the PV controller obtains the update event of the PVC object, it processes the annotation (volume.kubernetes.io/selected-node), obtains the node object based on the nodeName, and then passes it to the external-provisioner.
    4. The external-provisioner obtains the AZ based on the label of the passed node object (failure-domain.beta.kubernetes.io/zone), and then creates the PV in the corresponding AZ. In this way, it can be in the same AZ as the pod, and you can prevent cloud disk mounting failure caused by cloud disks and the node being in different AZs.

    Prerequisites

    • You have installed a TKE cluster of v1.14 or later versions. For more information, see Creating a Cluster.
    • You have updated CBS-CSI or In-Tree to the latest version.

    Directions

    Use the following YAML to set volumeBindingMode to WaitForFirstConsumer in the Storageclass. Below is a sample:

    kind: StorageClass
    metadata:
    name: cbs-topo
    parameters:
    type: cbs
    provisioner: com.tencent.cloud.csi.cbs
    reclaimPolicy: Delete
    volumeBindingMode: WaitForFirstConsumer
    
    Note:

    Both CBS-CSI and In-Tree support this operation.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support