CSIDriver
apiVersion: storage.k8s.io/v1
import "k8s.io/api/storage/v1"
CSIDriver
CSIDriver 捕获有关集群上部署的容器存储接口 (CSI) 卷驱动程序的信息。 Kubernetes attach detach controller 使用此对象来确定是否需要附加。 Kubelet 使用此对象来确定是否需要将 Pod 信息传递到挂载。 CSIDriver 对象是非命名空间的。
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata (ObjectMeta)
标准对象元数据。 metadata.Name 指示此对象引用的 CSI 驱动程序的名称;它必须与该驱动程序返回的 CSI GetPluginName() 调用返回的名称相同。 驱动程序名称必须少于或等于 63 个字符,以字母数字字符 ([a-z0-9A-Z]) 开头和结尾,中间为短划线 (-)、点 (.) 和字母数字。 更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec (CSIDriverSpec), required
spec 表示 CSI 驱动程序的规范。
CSIDriverSpec
CSIDriverSpec 是 CSIDriver 的规范。
attachRequired (boolean)
attachRequired 指示此 CSI 卷驱动程序需要附加操作(因为它实现了 CSI ControllerPublishVolume() 方法),并且 Kubernetes 附加分离控制器应调用附加卷接口,该接口检查卷附加状态并在继续挂载之前等待卷附加。 CSI 外部附加程序与 CSI 卷驱动程序协调并在附加操作完成后更新卷附加状态。 如果该值为 false,则将跳过附加操作。 否则将调用附加操作。
此字段是不可变的。
fsGroupPolicy (string)
fsGroupPolicy 定义了底层卷是否支持在挂载之前更改卷的所有权和权限。 请参阅特定的 FSGroupPolicy 值以获取更多详细信息。
此字段在 Kubernetes < 1.29 中是不可变的,现在是可变的。
默认值为 ReadWriteOnceWithFSType,它将检查每个卷以确定 Kubernetes 是否应修改卷的所有权和权限。 默认策略下,只有在定义了 fstype 并且卷的访问模式包含 ReadWriteOnce 时,才会应用定义的 fsGroup。
nodeAllocatableUpdatePeriodSeconds (int64)
nodeAllocatableUpdatePeriodSeconds 指定此驱动程序的 CSINode 可分配容量的定期更新之间的间隔。 设置后,将启用定期更新和由容量相关故障触发的更新。 如果未设置,则不会发生更新(既不定期也不在检测到容量相关故障时),并且 allocatable.count 保持静态。 此字段允许的最小值为 10 秒。
这是一个 Beta 功能,需要启用 MutableCSINodeAllocatableCount 特性门控。
此字段是可变的。
podInfoOnMount (boolean)
podInfoOnMount 指示此 CSI 卷驱动程序在挂载操作期间需要其他 Pod 信息(如 podName、podUID 等),如果设置为 true。 如果设置为 false,则不会将 Pod 信息传递到挂载。 默认值为 false。
CSI 驱动程序在驱动程序部署中指定 podInfoOnMount。 如果为 true,Kubelet 将在 CSI NodePublishVolume() 调用中将 Pod 信息作为 VolumeContext 传递。 CSI 驱动程序负责解析和验证作为 VolumeContext 传递的信息。
如果 podInfoOnMount 设置为 true,将传递以下 VolumeContext。 此列表可能会增长,但将使用前缀。 "csi.storage.k8s.io/pod.name": pod.Name "csi.storage.k8s.io/pod.namespace": pod.Namespace "csi.storage.k8s.io/pod.uid": string(pod.UID) "csi.storage.k8s.io/ephemeral": 如果卷是 CSIVolumeSource 定义的临时内联卷,则为 "true",否则为 "false"
"csi.storage.k8s.io/ephemeral" 是 Kubernetes 1.16 中的一项新功能。 它仅适用于支持 "Persistent" 和 "Ephemeral" VolumeLifecycleMode 的驱动程序。 其他驱动程序可以禁用 Pod 信息和/或忽略此字段。 由于 Kubernetes 1.15 不支持此字段,因此驱动程序在这样的集群上部署时只能支持一种模式,例如通过驱动程序的命令行参数确定该模式。
此字段在 Kubernetes < 1.29 中是不可变的,现在是可变的。
requiresRepublish (boolean)
requiresRepublish 指示 CSI 驱动程序希望定期调用
NodePublishVolume以反映已挂载卷的任何可能更改。 此字段默认为 false。注意:在成功初始 NodePublishVolume 调用之后,后续对 NodePublishVolume 的调用应仅更新卷的内容。 运行中的容器将看不到新的挂载点。
seLinuxMount (boolean)
seLinuxMount 指定 CSI 驱动程序是否支持 "-o context" 挂载选项。
当为 "true" 时,CSI 驱动程序必须确保此 CSI 驱动程序提供的所有卷都可以使用不同的
-o context选项单独挂载。 这通常适用于将卷作为块设备上的文件系统或作为独立的共享卷提供的存储后端。 Kubernetes 将在挂载 ReadWriteOncePod 卷时,该卷用于具有显式设置 SELinux 上下文的 Pod 中,使用带有 "-o context=xyz" 挂载选项的 NodeStage / NodePublish。 在未来,它可能会扩展到其他卷 AccessModes。 在任何情况下,Kubernetes 都会确保卷仅使用单个 SELinux 上下文挂载。当为 "false" 时,Kubernetes 不会将任何特殊的 SELinux 挂载选项传递给驱动程序。 这通常适用于表示更大共享文件系统子目录的卷。
默认值为 "false"。
serviceAccountTokenInSecrets (boolean)
serviceAccountTokenInSecrets 是 CSI 驱动程序选择加入的功能,用于指示应通过 NodePublishVolumeRequest 中的 Secrets 字段而不是 VolumeContext 字段传递 Pod 的服务帐户令牌。 CSI 规范为敏感信息(如令牌)提供了专用的 Secrets 字段,这是处理凭据的适当机制。 这解决了安全问题,即敏感令牌作为卷上下文被记录。
当为 "true" 时,kubelet 将仅在 Secrets 字段中,键为 "csi.storage.k8s.io/serviceAccount.tokens" 中传递令牌。 CSI 驱动程序必须更新为从 Secrets 字段而不是 VolumeContext 读取令牌。
当为 "false" 或未设置时,kubelet 将在 VolumeContext 中,键为 "csi.storage.k8s.io/serviceAccount.tokens" 中传递令牌(现有行为)。 这保持了与现有 CSI 驱动程序的向后兼容性。
仅当配置了 TokenRequests 时,才能设置此字段。 API 服务器将拒绝设置此字段而没有 TokenRequests 的 CSIDriver 规范。
如果未设置,默认行为是将令牌传递到 VolumeContext 字段。
storageCapacity (boolean)
storageCapacity 指示 CSI 卷驱动程序希望 Pod 调度考虑驱动程序部署将通过创建包含容量信息的 CSIStorageCapacity 对象报告的存储容量,如果设置为 true。
可以在部署驱动程序时立即启用检查。 在这种情况下,使用延迟绑定进行新卷的配置将暂停,直到驱动程序部署发布了合适的 CSIStorageCapacity 对象。
或者,可以先部署驱动程序,并将该字段设置为未设置或 false,然后在发布存储容量信息后将其翻转。
此字段在 Kubernetes <= 1.22 中是不可变的,现在是可变的。
tokenRequests ([]TokenRequest)
原子:将在合并期间被替换
tokenRequests 指示 CSI 驱动程序需要它正在挂载卷的 Pod 的服务帐户令牌才能执行必要的身份验证。 Kubelet 将在 CSI NodePublishVolume 调用中将令牌作为 VolumeContext 传递。 CSI 驱动程序应解析并验证以下 VolumeContext:“csi.storage.k8s.io/serviceAccount.tokens”:{“<audience>”:{“token”:<token>,“expirationTimestamp”:<RFC3339 格式的到期时间戳>,},...}
注意:每个 TokenRequest 中的受众应不同,并且最多一个令牌为空字符串。 要在到期后接收新令牌,可以使用 RequiresRepublish 定期触发 NodePublishVolume。
tokenRequests.audience (string), required
audience 是 "TokenRequestSpec" 中令牌的预期受众。 它将默认为 kube apiserver 的受众。
tokenRequests.expirationSeconds (int64)
expirationSeconds 是 "TokenRequestSpec" 中令牌的有效期,以秒为单位。 它与 "TokenRequestSpec" 中的 "ExpirationSeconds" 具有相同的默认值。
volumeLifecycleModes ([]string)
集合:合并期间将保留唯一值
volumeLifecycleModes 定义了此 CSI 卷驱动程序支持的卷类型。 如果列表为空,则默认值为 "Persistent",这是 CSI 规范定义的用法,以及 Kubernetes 通过通常的 PV/PVC 机制实现的方式。
另一种模式是 "Ephemeral"。 在这种模式下,卷是在 Pod 规范内使用 CSIVolumeSource 内联定义的,它们的生命周期与该 Pod 的生命周期相关联。 驱动程序必须意识到这一点,因为它只会为这样的卷收到 NodePublishVolume 调用。
有关实现此模式的更多信息,请参阅 https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html 驱动程序可以支持这些模式中的一个或多个,并且将来可能会添加更多模式。
此字段是 Beta 版本。 此字段是不可变的。
CSIDriverList
CSIDriverList 是 CSIDriver 对象的集合。
apiVersion: storage.k8s.io/v1
kind: CSIDriverList
metadata (ListMeta)
标准列表元数据 更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
items ([]CSIDriver), required
items 是 CSIDriver 列表
操作
get 读取指定的 CSIDriver
HTTP 请求
GET /apis/storage.k8s.io/v1/csidrivers/{name}
Parameters
name (在路径中): string, 必需
CSIDriver 的名称
pretty (在查询中): string
响应
200 (CSIDriver): OK
401: 未授权
list 列出或监视 CSIDriver 类型的对象
HTTP 请求
GET /apis/storage.k8s.io/v1/csidrivers
Parameters
allowWatchBookmarks (in query): boolean
continue (in query): string
fieldSelector (in query): string
labelSelector (in query): string
limit (in query): integer
pretty (在查询中): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
watch (in query): boolean
响应
200 (CSIDriverList): 正常
401: 未授权
create 创建一个 CSIDriver
HTTP 请求
POST /apis/storage.k8s.io/v1/csidrivers
Parameters
body: CSIDriver, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (CSIDriver): OK
201 (CSIDriver): 已创建
202 (CSIDriver): 已接受
401: 未授权
update 替换指定的 CSIDriver
HTTP 请求
PUT /apis/storage.k8s.io/v1/csidrivers/{name}
Parameters
name (在路径中): string, 必需
CSIDriver 的名称
body: CSIDriver, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
pretty (在查询中): string
响应
200 (CSIDriver): OK
201 (CSIDriver): 已创建
401: 未授权
patch 部分更新指定的 CSIDriver
HTTP 请求
PATCH /apis/storage.k8s.io/v1/csidrivers/{name}
Parameters
name (在路径中): string, 必需
CSIDriver 的名称
body: Patch, 必需
dryRun (在查询中): string
fieldManager (在查询中): string
fieldValidation (在查询中): string
force (in query): boolean
pretty (在查询中): string
响应
200 (CSIDriver): OK
201 (CSIDriver): 已创建
401: 未授权
delete 删除一个 CSIDriver
HTTP 请求
DELETE /apis/storage.k8s.io/v1/csidrivers/{name}
Parameters
name (在路径中): string, 必需
CSIDriver 的名称
body: DeleteOptions
dryRun (在查询中): string
gracePeriodSeconds (in query): integer
ignoreStoreReadErrorWithClusterBreakingPotential (in query): boolean
pretty (在查询中): string
propagationPolicy (in query): string
响应
200 (CSIDriver): OK
202 (CSIDriver): 已接受
401: 未授权
deletecollection 删除 CSIDriver 集合
HTTP 请求
DELETE /apis/storage.k8s.io/v1/csidrivers
Parameters
body: DeleteOptions
continue (in query): string
dryRun (在查询中): string
fieldSelector (in query): string
gracePeriodSeconds (in query): integer
ignoreStoreReadErrorWithClusterBreakingPotential (in query): boolean
labelSelector (in query): string
limit (in query): integer
pretty (在查询中): string
propagationPolicy (in query): string
resourceVersion (in query): string
resourceVersionMatch (in query): string
sendInitialEvents (in query): boolean
timeoutSeconds (in query): integer
响应
200 (Status): 确定
401: 未授权
本页面是自动生成的。
如果您打算报告此页面的问题,请在您的问题描述中提及该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。