操作场景
说明:
CBS-CSI 是 TKE 集群中默认提供并由腾讯云维护的内置扩展组件,对应的开源代码托管于 TencentCloud/kubernetes-csi-tencentcloud。在 TKE 集群中通过组件管理安装的 CBS-CSI 与开源仓库版本同源,集群创建时可选择默认安装,无需自行从开源仓库部署。
功能特性
功能 | 说明 |
静态数据卷 | 支持手动创建 Volume、PV 对象及 PVC 对象。 |
动态数据卷 | 支持通过 StorageClass 配置、创建和删除 Volume 及 PV 对象。 |
存储拓扑感知 | 云硬盘不支持跨可用区挂载,在多可用区集群中,CBS-CSI 组件将先调度 Pod,后调度 Node 的 zone 创建 Volume。 |
调度器感知节点 maxAttachLimit | 腾讯云单个云服务器上默认最多挂载20块云硬盘,调度器调度 Pod 时将过滤超过最大可挂载云硬盘数量的节点。 |
卷在线扩容 | 支持通过修改 PVC 容量字段,实现在线扩容(仅支持云硬盘类型)。 |
卷快照和恢复 | 支持通过快照创建数据卷。 |
组件说明
CBS-CSI 组件在集群内部署后,包含以下组件:
DaemonSet:每个 Node 提供一个 DaemonSet,简称为 NodePlugin。由 CBS-CSI Driver 和 node-driver-registrar 两个容器组成,负责向节点注册 Driver,并提供挂载能力。
StatefulSet 和 Deployment:简称为 Controller。由 Driver 和多个 Sidecar(external-provisioner、external-attacher、external-resizer、external-snapshotter、snapshot-controller)一起构成,提供创删卷、attach、detach、扩容、快照等能力。
示例图如下:


限制条件
TKE 集群版本 ≥ 1.14
使用 CBS-CSI 组件后,才可在 TKE 集群中为云硬盘在线扩容和创建快照。
已经使用 QcloudCbs(In-Tree 插件)的 TKE 集群,可以继续正常使用。(后续将通过 Volume Migration 统一到 CBS-CSI)
CBS-CSI 组件版本 ≥ 1.0.4,支持原生节点。
在 TKE on Tencent CDC(本地专用集群)上使用 CBS-CSI
CBS-CSI 同样适用于运行在腾讯云本地专用集群(简称 CDC)上的 TKE 集群,用于在 CDC 节点上提供本地块存储能力。
前置条件:
CDC 节点与公有云控制面(包括对应地域的 CBS API)网络互通。CDC 出口断网期间,CBS-CSI 无法创建、挂载或扩容云硬盘。
集群已开通 CDC 所在地域可用区的 CBS 服务。
部署与配置:
TKE on Tencent CDC 集群创建时勾选默认安装 CBS-CSI,或在组件管理中手动安装即可,无需在 CDC 上自行部署开源版本。
单个 CBS-CSI Controller 实例当前仅支持一个 CDC 实例。Controller 会将该集群的 CBS 操作转发到指定的 CDC 上,对应的 CDC 实例 ID 由 TKE 在创建集群时自动注入,用户无需手工配置。
多 CDC 场景:如业务横跨多个 CDC,需为每个 CDC 单独创建 TKE 集群(每集群一套 CBS-CSI 实例),不能在同一集群中跨 CDC 共享 CBS 卷。
StorageClass 配置要点:
StorageClass 中的
topology.com.tencent.cloud.csi.cbs/zone 必须指定为 CDC 所在的可用区。建议同时设置
volumeBindingMode: WaitForFirstConsumer,由调度器先选定运行 Pod 的 CDC 节点,再创建对应可用区的 CBS 卷,避免出现 Pod 与 CBS 卷不在同一可用区导致的挂载失败。使用限制:
CBS 卷仅能挂载到与其同一 CDC、同一可用区内的 CVM/CDC 节点,不支持跨可用区或跨 CDC 挂载。
CDC 与公有云断网时,已挂载的 CBS 卷数据 IO 不受影响,但创建/扩容/快照等控制面操作会失败,待网络恢复后重试。
cbs-csi 权限
说明:
权限场景章节中仅列举了组件核心功能涉及到的相关权限,完整权限列表请参考权限定义章节。
权限说明
该组件权限是当前功能实现的最小权限依赖。
需要挂载主机 /var/lib/kubelet 相关目录到容器来完成 volume 的 mount/umount,所以需要开启特权级容器。
权限场景
功能 | 涉及对象 | 涉及操作权限 |
获取 node 资源中 providerID 来感知节点最大可挂盘数量 | node | get/list |
根据 pvc/pv 等信息完成盘的创建和删除 | pv/pvc/storageclasses/csinode | get/list/watch/create/update/patch/delete |
根据 volumeattachments 资源对象来完成盘的挂载和卸载 | volumeattachments/volumesnapshotclasses | create/get/list/watch/update/delete |
对盘进行扩容快照 | pod/volumesnapshotclasses/volumesnapshots/configmap | get/list/watch |
权限定义
kind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1metadata:name: cbs-csi-controller-rolerules:- apiGroups: [""]resources: ["pods"]verbs: ["get", "list", "watch"]- apiGroups: [""]resources: ["persistentvolumes"]verbs: ["get", "list", "watch", "update", "patch", "create", "delete"]- apiGroups: [""]resources: ["persistentvolumeclaims"]verbs: ["get", "list", "watch", "update"]- apiGroups: [""]resources: ["persistentvolumeclaims/status"]verbs: ["update", "patch"]- apiGroups: ["storage.k8s.io"]resources: ["storageclasses"]verbs: ["get", "list", "watch"]- apiGroups: [""]resources: ["events"]verbs: ["get", "list", "watch", "create", "update", "patch"]- apiGroups: ["storage.k8s.io"]resources: ["csinodes"]verbs: ["get", "list", "watch"]- apiGroups: [""]resources: ["nodes"]verbs: ["get", "list", "watch"]- apiGroups: ["coordination.k8s.io"]resources: ["leases"]verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]- apiGroups: ["csi.storage.k8s.io"]resources: ["csinodeinfos"]verbs: ["get", "list", "watch"]- apiGroups: ["storage.k8s.io"]resources: ["volumeattachments", "volumeattachments/status"]verbs: ["get", "list", "watch", "update", "patch"]- apiGroups: ["snapshot.storage.k8s.io"]resources: ["volumesnapshotclasses"]verbs: ["get", "list", "watch"]- apiGroups: ["snapshot.storage.k8s.io"]resources: ["volumesnapshotcontents"]verbs: ["create", "get", "list", "watch", "update", "delete"]- apiGroups: ["snapshot.storage.k8s.io"]resources: ["volumesnapshots"]verbs: ["get", "list", "watch", "update"]- apiGroups: ["apiextensions.k8s.io"]resources: ["customresourcedefinitions"]verbs: ["create", "list", "watch", "delete"]- apiGroups: ["snapshot.storage.k8s.io"]resources: ["volumesnapshotcontents/status"]verbs: ["update"]- apiGroups: ["snapshot.storage.k8s.io"]resources: ["volumesnapshots/status"]verbs: ["update"]- apiGroups: [""]resources: ["configmaps"]verbs: ["get", "list", "watch", "update", "patch", "create", "delete"]---kind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1metadata:name: cbs-csi-node-rolenamespace: kube-systemrules:- apiGroups: [""]resources: ["nodes"]verbs: ["get", "list"]