VolumeAttachment

VolumeAttachment 捕获将指定卷挂接到/从指定节点卸载的意图。

apiVersion: storage.k8s.io/v1

import "k8s.io/api/storage/v1"

VolumeAttachment

VolumeAttachment 捕获将指定卷挂接到/从指定节点卸载的意图。

VolumeAttachment 对象是非命名空间的。


VolumeAttachmentSpec

VolumeAttachmentSpec 是 VolumeAttachment 请求的规范。


  • attacher (字符串),必需

    attacher 指示必须处理此请求的卷驱动程序的名称。这是由 GetPluginName() 返回的名称。

  • nodeName (字符串),必需

    nodeName 表示应将卷挂接到哪个节点。

  • source (VolumeAttachmentSource),必需

    source 表示应被挂接的卷。

    VolumeAttachmentSource 表示应被挂接的卷。目前只有 PersistentVolumes 可以通过 external attacher 挂接,未来我们可能允许在 Pod 中使用 inline volumes。只能设置一个成员。

    • source.inlineVolumeSpec (PersistentVolumeSpec)

      inlineVolumeSpec 包含挂接由 Pod 的 inline VolumeSource 定义的持久卷所需的所有信息。此字段仅针对 CSIMigration 特性填充。它包含从 Pod 的 inline VolumeSource 转换到 PersistentVolumeSpec 的字段。此字段处于 Beta 级别,并且仅被启用了 CSIMigration 特性的服务器支持。

    • source.persistentVolumeName (字符串)

      persistentVolumeName 表示要挂接的持久卷的名称。

VolumeAttachmentStatus

VolumeAttachmentStatus 是 VolumeAttachment 请求的状态。


  • attached (布尔型),必需

    attached 表示卷已成功挂接。此字段只能由完成挂接操作的实体(即 external-attacher)设置。

  • attachError (VolumeError)

    attachError 表示挂接操作期间遇到的最后一个错误(如果有)。此字段只能由完成挂接操作的实体(即 external-attacher)设置。

    VolumeError 捕获卷操作期间遇到的错误。

    • attachError.errorCode (int32)

      errorCode 是表示在挂接或卸载操作期间遇到的错误的数字 gRPC 代码。

      这是一个可选的 Alpha 字段,需要启用 MutableCSINodeAllocatableCount 特性门控才能设置。

    • attachError.message (字符串)

      message 表示在挂接或卸载操作期间遇到的错误。此字符串可能会被记录下来,因此不应包含敏感信息。

    • attachError.time (Time)

      time 表示遇到错误的时间。

      Time 是 time.Time 的一个包装器,支持正确编组为 YAML 和 JSON。提供了许多 time 包提供的工厂方法的包装器。

  • attachmentMetadata (map[string]string)

    attachmentMetadata 填充了挂接操作成功后返回的任何信息,这些信息必须传递到后续的 WaitForAttach 或 Mount 调用中。此字段只能由完成挂接操作的实体(即 external-attacher)设置。

  • detachError (VolumeError)

    detachError 表示卸载操作期间遇到的最后一个错误(如果有)。此字段只能由完成卸载操作的实体(即 external-attacher)设置。

    VolumeError 捕获卷操作期间遇到的错误。

    • detachError.errorCode (int32)

      errorCode 是表示在挂接或卸载操作期间遇到的错误的数字 gRPC 代码。

      这是一个可选的 Alpha 字段,需要启用 MutableCSINodeAllocatableCount 特性门控才能设置。

    • detachError.message (字符串)

      message 表示在挂接或卸载操作期间遇到的错误。此字符串可能会被记录下来,因此不应包含敏感信息。

    • detachError.time (Time)

      time 表示遇到错误的时间。

      Time 是 time.Time 的一个包装器,支持正确编组为 YAML 和 JSON。提供了许多 time 包提供的工厂方法的包装器。

VolumeAttachmentList

VolumeAttachmentList 是 VolumeAttachment 对象的集合。


操作


get 读取指定的 VolumeAttachment

HTTP 请求

GET /apis/storage.k8s.io/v1/volumeattachments/{name}

参数

  • name (in path): 字符串,必需

    VolumeAttachment 的名称

  • pretty (in query): 字符串

    pretty

响应

200 (VolumeAttachment): OK

401: 未授权 (Unauthorized)

get 读取指定的 VolumeAttachment 的状态

HTTP 请求

GET /apis/storage.k8s.io/v1/volumeattachments/{name}/status

参数

  • name (in path): 字符串,必需

    VolumeAttachment 的名称

  • pretty (in query): 字符串

    pretty

响应

200 (VolumeAttachment): OK

401: 未授权 (Unauthorized)

list 列出或监视 VolumeAttachment 类型的对象

HTTP 请求

GET /apis/storage.k8s.io/v1/volumeattachments

参数

响应

200 (VolumeAttachmentList): OK

401: 未授权 (Unauthorized)

create 创建一个 VolumeAttachment

HTTP 请求

POST /apis/storage.k8s.io/v1/volumeattachments

参数

响应

200 (VolumeAttachment): OK

201 (VolumeAttachment): 已创建 (Created)

202 (VolumeAttachment): 已接受 (Accepted)

401: 未授权 (Unauthorized)

update 替换指定的 VolumeAttachment

HTTP 请求

PUT /apis/storage.k8s.io/v1/volumeattachments/{name}

参数

响应

200 (VolumeAttachment): OK

201 (VolumeAttachment): 已创建 (Created)

401: 未授权 (Unauthorized)

update 替换指定的 VolumeAttachment 的状态

HTTP 请求

PUT /apis/storage.k8s.io/v1/volumeattachments/{name}/status

参数

响应

200 (VolumeAttachment): OK

201 (VolumeAttachment): 已创建 (Created)

401: 未授权 (Unauthorized)

patch 部分更新指定的 VolumeAttachment

HTTP 请求

PATCH /apis/storage.k8s.io/v1/volumeattachments/{name}

参数

  • name (in path): 字符串,必需

    VolumeAttachment 的名称

  • body: Patch,必需

  • dryRun (in query): 字符串

    dryRun

  • fieldManager (in query): 字符串

    fieldManager

  • fieldValidation (in query): 字符串

    fieldValidation

  • force (in query): 布尔型

    force

  • pretty (in query): 字符串

    pretty

响应

200 (VolumeAttachment): OK

201 (VolumeAttachment): 已创建 (Created)

401: 未授权 (Unauthorized)

patch 部分更新指定的 VolumeAttachment 的状态

HTTP 请求

PATCH /apis/storage.k8s.io/v1/volumeattachments/{name}/status

参数

  • name (in path): 字符串,必需

    VolumeAttachment 的名称

  • body: Patch,必需

  • dryRun (in query): 字符串

    dryRun

  • fieldManager (in query): 字符串

    fieldManager

  • fieldValidation (in query): 字符串

    fieldValidation

  • force (in query): 布尔型

    force

  • pretty (in query): 字符串

    pretty

响应

200 (VolumeAttachment): OK

201 (VolumeAttachment): 已创建 (Created)

401: 未授权 (Unauthorized)

delete 删除一个 VolumeAttachment

HTTP 请求

DELETE /apis/storage.k8s.io/v1/volumeattachments/{name}

参数

响应

200 (VolumeAttachment): OK

202 (VolumeAttachment): 已接受 (Accepted)

401: 未授权 (Unauthorized)

deletecollection 删除 VolumeAttachment 集合

HTTP 请求

DELETE /apis/storage.k8s.io/v1/volumeattachments

参数

响应

200 (Status): OK

401: 未授权 (Unauthorized)

此页面是自动生成的。

如果您计划报告此页面存在问题,请在问题描述中提及此页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。

最后修改时间:2025年4月24日 上午9:14 PST: v1.33 的 Markdown API 参考 (b84ec30bbb)