--- api_metadata: apiVersion: "storage.k8s.io/v1" import: "k8s.io/api/storage/v1" kind: "VolumeAttachment" content_type: "api_reference" description: "VolumeAttachment 抓取将指定卷挂接到指定节点或从指定节点解除挂接指定卷的意图。" title: "VolumeAttachment" weight: 7 --- `apiVersion: storage.k8s.io/v1` `import "k8s.io/api/storage/v1"` ## VolumeAttachment {#VolumeAttachment} VolumeAttachment 抓取将指定卷挂接到指定节点或从指定节点解除挂接指定卷的意图。 VolumeAttachment 对象未划分命名空间。
- **apiVersion**: storage.k8s.io/v1 - **kind**: VolumeAttachment - **metadata** (}}">ObjectMeta) 标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - **spec** (}}">VolumeAttachmentSpec),必需 spec 表示期望的挂接/解除挂接卷行为的规约。由 Kubernetes 系统填充。 - **status** (}}">VolumeAttachmentStatus) status 表示 VolumeAttachment 请求的状态。由完成挂接或解除挂接操作的实体(即外部挂接器)进行填充。 ## VolumeAttachmentSpec {#VolumeAttachmentSpec} VolumeAttachmentSpec 是 VolumeAttachment 请求的规约。
- **attacher** (string),必需 attacher 表示必须处理此请求的卷驱动的名称。这是由 GetPluginName() 返回的名称。 - **nodeName** (string),必需 nodeName 表示卷应挂接到的节点。 - **source** (VolumeAttachmentSource),必需 source 表示应挂接的卷。 **VolumeAttachmentSource 表示应挂接的卷。现在只能通过外部挂接器挂接 PersistenVolume, 将来我们可能还允许 Pod 中的内联卷。只能设置一个成员。** - **source.inlineVolumeSpec** (}}">PersistentVolumeSpec) inlineVolumeSpec 包含挂接由 Pod 的内联 VolumeSource 定义的持久卷时所有必需的信息。 仅为 CSIMigation 功能填充此字段。 它包含从 Pod 的内联 VolumeSource 转换为 PersistentVolumeSpec 的字段。 此字段处于 Beta 阶段,且只有启用 CSIMigration 功能的服务器才能使用此字段。 - **source.persistentVolumeName** (string) persistentVolumeName 是要挂接的持久卷的名称。 ## VolumeAttachmentStatus {#VolumeAttachmentStatus} VolumeAttachmentStatus 是 VolumeAttachment 请求的状态。
- **attached** (boolean),必需 attached 表示卷被成功挂接。此字段只能由完成挂接操作的实体(例如外部挂接器)进行设置。 - **attachError** (VolumeError) attachError 表示挂接操作期间遇到的最后一个错误,如果有。 此字段只能由完成挂接操作的实体(例如外部挂接器)进行设置。 **VolumeError 抓取卷操作期间遇到的一个错误。** - **attachError.message** (string) message 表示挂接或解除挂接操作期间遇到的错误。 此字符串可以放入日志,因此它不应包含敏感信息。 - **attachError.time** (Time) 遇到错误的时间。 **time 是 time.Time 的包装类,支持正确地序列化为 YAML 和 JSON。 为 time 包提供的许多工厂方法提供了包装类。** - **attachmentMetadata** (map[string]string) 成功挂接时,attachmentMetadata 字段将由挂接操作返回的任何信息进行填充, 这些信息必须传递到后续的 WaitForAttach 或 Mount 调用中。 此字段只能由完成挂接操作的实体(例如外部挂接器)进行设置。 - **detachError** (VolumeError) detachError 表示解除挂接操作期间遇到的最后一个错误,如果有。 此字段只能由完成解除挂接操作的实体(例如外部挂接器)进行设置。 **VolumeError 抓取卷操作期间遇到的一个错误。** - **detachError.message** (string) message 表示挂接或解除挂接操作期间遇到的错误。 此字符串可以放入日志,因此它不应包含敏感信息。 - **detachError.time** (Time) time 表示遇到错误的时间。 **time 是 time.Time 的包装类,支持正确地序列化为 YAML 和 JSON。 为 time 包提供的许多工厂方法提供了包装类。** ## VolumeAttachmentList {#VolumeAttachmentList} VolumeAttachmentList 是 VolumeAttachment 对象的集合。
- **apiVersion**: storage.k8s.io/v1 - **kind**: VolumeAttachmentList - **metadata** (}}">ListMeta) 标准的列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - **items** ([]}}">VolumeAttachment),必需 items 是 VolumeAttachment 的列表。 ## 操作 {#Operations}
### `get` 读取指定的 VolumeAttachment #### HTTP 请求 GET /apis/storage.k8s.io/v1/volumeattachments/{name} #### 参数 - **name** (**路径参数**): string,必需 VolumeAttachment 的名称 - **pretty** (**查询参数**): string }}">pretty #### 响应 200 (}}">VolumeAttachment): OK 401: Unauthorized ### `get` 读取指定的 VolumeAttachment 的状态 #### HTTP 请求 GET /apis/storage.k8s.io/v1/volumeattachments/{name}/status #### 参数 - **name** (**路径参数**): string,必需 VolumeAttachment 的名称 - **pretty** (**查询参数**): string }}">pretty #### 响应 200 (}}">VolumeAttachment): OK 401: Unauthorized ### `list` 列出或观测类别为 VolumeAttachment 的对象 #### HTTP 请求 GET /apis/storage.k8s.io/v1/volumeattachments #### 参数 - **allowWatchBookmarks** (**查询参数**): boolean }}">allowWatchBookmarks - **continue** (**查询参数**): string }}">continue - **fieldSelector** (**查询参数**): string }}">fieldSelector - **labelSelector** (**查询参数**): string }}">labelSelector - **limit** (**查询参数**): integer }}">limit - **pretty** (**查询参数**): string }}">pretty - **resourceVersion** (**查询参数**): string }}">resourceVersion - **resourceVersionMatch** (**查询参数**): string }}">resourceVersionMatch - **sendInitialEvents** (**查询参数**): boolean }}">sendInitialEvents - **timeoutSeconds** (**查询参数**): integer }}">timeoutSeconds - **watch** (**查询参数**): boolean }}">watch #### 响应 200 (}}">VolumeAttachmentList): OK 401: Unauthorized ### `create` 创建 VolumeAttachment #### HTTP 请求 POST /apis/storage.k8s.io/v1/volumeattachments #### 参数 - **body**: }}">VolumeAttachment,必需 - **dryRun** (**查询参数**): string }}">dryRun - **fieldManager** (**查询参数**): string }}">fieldManager - **fieldValidation** (**查询参数**): string }}">fieldValidation - **pretty** (**查询参数**): string }}">pretty #### 响应 200 (}}">VolumeAttachment): OK 201 (}}">VolumeAttachment): Created 202 (}}">VolumeAttachment): Accepted 401: Unauthorized ### `update` 替换指定的 VolumeAttachment #### HTTP 请求 PUT /apis/storage.k8s.io/v1/volumeattachments/{name} #### 参数 - **name** (**路径参数**): string,必需 VolumeAttachment 的名称 - **body**: }}">VolumeAttachment,必需 - **dryRun** (**查询参数**): string }}">dryRun - **fieldManager** (**查询参数**): string }}">fieldManager - **fieldValidation** (**查询参数**): string }}">fieldValidation - **pretty** (**查询参数**): string }}">pretty #### 响应 200 (}}">VolumeAttachment): OK 201 (}}">VolumeAttachment): Created 401: Unauthorized ### `update` 替换指定的 VolumeAttachment 的状态 #### HTTP 请求 PUT /apis/storage.k8s.io/v1/volumeattachments/{name}/status #### 参数 - **name** (**路径参数**): string,必需 VolumeAttachment 的名称 - **body**: }}">VolumeAttachment,必需 - **dryRun** (**查询参数**): string }}">dryRun - **fieldManager** (**查询参数**): string }}">fieldManager - **fieldValidation** (**查询参数**): string }}">fieldValidation - **pretty** (**查询参数**): string }}">pretty #### 响应 200 (}}">VolumeAttachment): OK 201 (}}">VolumeAttachment): Created 401: Unauthorized ### `patch` 部分更新指定的 VolumeAttachment #### HTTP 请求 PATCH /apis/storage.k8s.io/v1/volumeattachments/{name} #### 参数 - **name** (**路径参数**): string,必需 VolumeAttachment 的名称 - **body**: }}">Patch,必需 - **dryRun** (**查询参数**): string }}">dryRun - **fieldManager** (**查询参数**): string }}">fieldManager - **fieldValidation** (**查询参数**): string }}">fieldValidation - **force** (**查询参数**): boolean }}">force - **pretty** (**查询参数**): string }}">pretty #### 响应 200 (}}">VolumeAttachment): OK 201 (}}">VolumeAttachment): Created 401: Unauthorized ### `patch` 部分更新指定的 VolumeAttachment 的状态 #### HTTP 请求 PATCH /apis/storage.k8s.io/v1/volumeattachments/{name}/status #### 参数 - **name** (**路径参数**): string,必需 VolumeAttachment 的名称 - **body**: }}">Patch,必需 - **dryRun** (**查询参数**): string }}">dryRun - **fieldManager** (**查询参数**): string }}">fieldManager - **fieldValidation** (**查询参数**): string }}">fieldValidation - **force** (**查询参数**): boolean }}">force - **pretty** (**查询参数**): string }}">pretty #### 响应 200 (}}">VolumeAttachment): OK 201 (}}">VolumeAttachment): Created 401: Unauthorized ### `delete` 删除 VolumeAttachment #### HTTP 请求 DELETE /apis/storage.k8s.io/v1/volumeattachments/{name} #### 参数 - **name** (**路径参数**): string,必需 VolumeAttachment 的名称 - **body**: }}">DeleteOptions - **dryRun** (**查询参数**): string }}">dryRun - **gracePeriodSeconds** (**查询参数**): integer }}">gracePeriodSeconds - **pretty** (**查询参数**): string }}">pretty - **propagationPolicy** (**查询参数**): string }}">propagationPolicy #### 响应 200 (}}">VolumeAttachment): OK 202 (}}">VolumeAttachment): Accepted 401: Unauthorized ### `deletecollection` 删除 VolumeAttachment 的集合 #### HTTP 请求 DELETE /apis/storage.k8s.io/v1/volumeattachments #### 参数 - **body**: }}">DeleteOptions - **continue** (**查询参数**): string }}">continue - **dryRun** (**查询参数**): string }}">dryRun - **fieldSelector** (**查询参数**): string }}">fieldSelector - **gracePeriodSeconds** (**查询参数**): integer }}">gracePeriodSeconds - **labelSelector** (**查询参数**): string }}">labelSelector - **limit** (**查询参数**): integer }}">limit - **pretty** (**查询参数**): string }}">pretty - **propagationPolicy** (**查询参数**): string }}">propagationPolicy - **resourceVersion** (**查询参数**): string }}">resourceVersion - **resourceVersionMatch** (**查询参数**): string }}">resourceVersionMatch - **sendInitialEvents** (**查询参数**): boolean }}">sendInitialEvents - **timeoutSeconds** (**查询参数**): integer }}">timeoutSeconds #### 响应 200 (}}">Status): OK 401: Unauthorized