website/content/zh-cn/docs/reference/kubernetes-api/config-and-storage-resources/storage-class-v1.md

19 KiB
Raw Blame History

api_metadata content_type description title weight
apiVersion import kind
storage.k8s.io/v1 k8s.io/api/storage/v1 StorageClass
api_reference StorageClass 为可以动态制备 PersistentVolume 的存储类描述参数。 StorageClass 6

apiVersion: storage.k8s.io/v1

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

StorageClass

StorageClass 为可以动态制备 PersistentVolume 的存储类描述参数。

StorageClass 是不受名字空间作用域限制的;按照 etcd 设定的存储类的名称位于 ObjectMeta.Name 中。


  • apiVersion: storage.k8s.io/v1

  • kind: StorageClass

  • allowedTopologies ([]TopologySelectorTerm)

    原子性:将在合并期间被替换

    allowedTopologies 限制可以动态制备卷的节点拓扑。每个卷插件定义其自己支持的拓扑规约。 空的 TopologySelectorTerm 列表意味着没有拓扑限制。 只有启用 VolumeScheduling 功能特性的服务器才能使用此字段。

    拓扑选择器条件表示标签查询的结果。 一个 null 或空的拓扑选择器条件不会匹配任何对象。各个条件的要求按逻辑与的关系来计算。 此选择器作为 NodeSelectorTerm 所提供功能的子集。此功能为 Alpha 特性,将来可能会变更。

  • allowedTopologies.matchLabelExpressions ([]TopologySelectorLabelRequirement)

    按标签设置的拓扑选择器要求的列表。

    拓扑选择器要求是与给定标签匹配的一个选择器。此功能为 Alpha 特性,将来可能会变更。

    • allowedTopologies.matchLabelExpressions.key (string),必需

      选择器所针对的标签键。

    • allowedTopologies.matchLabelExpressions.values ([]string),必需

      字符串数组。一个值必须与要选择的标签匹配。values 中的每个条目按逻辑或的关系来计算。

  • mountOptions ([]string)

    mountOptions 控制此存储类动态制备的 PersistentVolume 的挂载配置。 (例如 ["ro", "soft"])。 系统对选项作检查——如果有一个选项无效,则这些 PV 的挂载将失败。

  • parameters (map[string]string)

    parameters 包含应创建此存储类卷的制备器的参数。

  • reclaimPolicy (string)

    reclaimPolicy 控制此存储类动态制备的 PersistentVolume 的 reclaimPolicy。默认为 Delete。

  • volumeBindingMode (string)

    volumeBindingMode 指示应该如何制备和绑定 PersistentVolumeClaim。 未设置时,将使用 VolumeBindingImmediate。 只有启用 VolumeScheduling 功能特性的服务器才能使用此字段。

StorageClassList

StorageClassList 是存储类的集合。


  • apiVersion: storage.k8s.io/v1

  • kind: StorageClassList

操作


get 读取指定的 StorageClass

HTTP 请求

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

参数

  • name (路径参数): string必需

    StorageClass 的名称

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): OK

401: Unauthorized

list 列出或观测类别为 StorageClass 的对象

HTTP 请求

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

参数

  • allowWatchBookmarks (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

  • watch (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch

响应

200 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClassList" >}}">StorageClassList): OK

401: Unauthorized

create 创建 StorageClass

HTTP 请求

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

参数

  • body: <a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): OK

201 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): Created

202 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): Accepted

401: Unauthorized

update 替换指定的 StorageClass

HTTP 请求

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

参数

  • name (路径参数): string必需

    StorageClass 的名称

  • body: <a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): OK

201 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): Created

401: Unauthorized

patch 部分更新指定的 StorageClass

HTTP 请求

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

参数

  • name (路径参数): string必需

    StorageClass 的名称

  • body: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • force (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#force" >}}">force

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): OK

201 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): Created

401: Unauthorized

delete 删除 StorageClass

HTTP 请求

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

参数

  • name (路径参数): string必需

    StorageClass 的名称

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

响应

200 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): OK

202 (<a href="{{< ref "../config-and-storage-resources/storage-class-v1#StorageClass" >}}">StorageClass): Accepted

401: Unauthorized

deletecollection 删除 StorageClass 的集合

HTTP 请求

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

参数

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

响应

200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK

401: Unauthorized