1 - ConfigMap
apiVersion: v1
import "k8s.io/api/core/v1"
ConfigMap
ConfigMap 包含供 Pod 使用的配置数据。
-
apiVersion: v1
-
kind: ConfigMap
-
metadata (ObjectMeta)
标准的对象元数据。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
binaryData (map[string][]byte)
binaryData 包含二进制数据。 每个键必须由字母、数字、“-”、“_” 或 “.” 组成。 binaryData 可以包含不在 UTF-8 范围中的字节序列。 binaryData 中存储的键不得与 data 字段中的键重叠,这在验证过程中是强制要求。 使用此字段需要 apiserver 和 kubelet 的版本高于 1.10。
-
data (map[string]string)
data 包含配置数据。 每个键必须由字母、数字、“-”、“_” 或 “.” 组成。 如果值包含非 UTF-8 字节序列,则必须使用 binaryData 字段。 data 中存储的键不得与 binaryData 字段中的键重叠,这在验证过程中是强制要求。
-
immutable (boolean)
如果 immutable 设为 true, 则确保不会更新 ConfigMap 中存储的数据(只能修改对象元数据)。 如果未设为 true,则可以随时修改此字段。 默认为 nil。
ConfigMapList
ConfigMapList 是包含 ConfigMap 对象列表的资源。
-
apiVersion: v1
-
kind: ConfigMapList
-
metadata (ListMeta)
更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
items ([]ConfigMap),必需
items 是 ConfigMap 的列表。
操作
get
读取指定的 ConfigMap
HTTP 请求
GET /api/v1/namespaces/{namespace}/configmaps/{name}
参数
-
name (路径参数): string,必需
ConfigMap 的名称
-
namespace (路径参数): string,必需
-
pretty (查询参数): string
响应
200 (ConfigMap): OK
401: Unauthorized
list
列出或观测类别为 ConfigMap 的对象
HTTP 请求
GET /api/v1/namespaces/{namespace}/configmaps
参数
-
namespace (路径参数): string,必需
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (ConfigMapList): OK
401: Unauthorized
list
列出或观测类别为 ConfigMap 的对象
HTTP 请求
GET /api/v1/configmaps
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (ConfigMapList): OK
401: Unauthorized
create
创建 ConfigMap
HTTP 请求
POST /api/v1/namespaces/{namespace}/configmaps
参数
-
namespace (路径参数): string,必需
-
body: ConfigMap,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (ConfigMap): OK
201 (ConfigMap): Created
202 (ConfigMap): Accepted
401: Unauthorized
update
替换指定的 ConfigMap
HTTP 请求
PUT /api/v1/namespaces/{namespace}/configmaps/{name}
参数
-
name (路径参数): string,必需
ConfigMap 的名称
-
namespace (路径参数): string,必需
-
body: ConfigMap,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (ConfigMap): OK
201 (ConfigMap): Created
401: Unauthorized
patch
部分更新指定的 ConfigMap
HTTP 请求
PATCH /api/v1/namespaces/{namespace}/configmaps/{name}
参数
-
name (路径参数): string,必需
ConfigMap 的名称
-
namespace (路径参数): string,必需
-
body: Patch,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (ConfigMap): OK
201 (ConfigMap): Created
401: Unauthorized
delete
删除 ConfigMap
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/configmaps/{name}
参数
-
name (路径参数): string,必需
ConfigMap 的名称
-
namespace (路径参数): string,必需
-
body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 ConfigMap 的集合
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/configmaps
参数
-
namespace (路径参数): string,必需
-
body: DeleteOptions
-
continue (查询参数): string
-
dryRun (查询参数): string
-
fieldSelector (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
响应
200 (Status): OK
401: Unauthorized
2 - Secret
apiVersion: v1
import "k8s.io/api/core/v1"
Secret
Secret 包含某些类别的秘密数据。 data 字段值的总字节必须小于 MaxSecretSize 字节。
-
apiVersion: v1
-
kind: Secret
-
metadata (ObjectMeta)
标准的对象元数据。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
data (map[string][]byte)
data 包含秘密数据。 每个键必须由字母、数字、“-”、“_” 或 “.” 组成。 秘密数据的序列化格式是 base64 编码的字符串,表示此处的任意(可能是非字符串)数据值。 请参阅 https://tools.ietf.org/html/rfc4648#section-4
-
immutable (boolean)
如果 immutable 设为 true,则确保不会更新 Secret 中存储的数据(只能修改对象元数据)。 如果未设为 true,则可以随时修改此字段。 默认为 nil。
-
stringData (map[string]string)
stringData 允许指定字符串格式的非二进制秘密数据。 为了方便起见,它作为只写输入字段提供。 写入时将所有键和值合并到 data 字段,且覆盖任何现有的值。 从 API 读取时绝不会输出 stringData 字段。
-
type (string)
用于满足程序化方式处理秘密数据。 更多信息: https://kubernetes.io/zh/docs/concepts/configuration/secret/#secret-types
SecretList
SecretList 是 Secret 的列表。
-
apiVersion: v1
-
kind: SecretList
-
metadata (ListMeta)
标准的列表元数据。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
-
items ([]Secret),必需
items 是 Secret 对象的列表。 更多信息: https://kubernetes.io/zh/docs/concepts/configuration/secret
操作
get
读取指定的 Secret
HTTP 请求
GET /api/v1/namespaces/{namespace}/secrets/{name}
参数
-
name (路径参数): string,必需
Secret 的名称
-
namespace (路径参数): string,必需
-
pretty (查询参数): string
响应
200 (Secret): OK
401: Unauthorized
list
列出或观测类别为 Secret 的对象
HTTP 请求
GET /api/v1/namespaces/{namespace}/secrets
参数
-
namespace (路径参数): string,必需
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (SecretList): OK
401: Unauthorized
list
列出或观测类别为 Secret 的对象
HTTP 请求
GET /api/v1/secrets
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (SecretList): OK
401: Unauthorized
create
创建 Secret
HTTP 请求
POST /api/v1/namespaces/{namespace}/secrets
参数
-
namespace (路径参数): string,必需
-
body: Secret,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (Secret): OK
201 (Secret): Created
202 (Secret): Accepted
401: Unauthorized
update
替换指定的 Secret
HTTP 请求
PUT /api/v1/namespaces/{namespace}/secrets/{name}
参数
-
name (路径参数): string,必需
Secret 的名称
-
namespace (路径参数): string,必需
-
body: Secret,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (Secret): OK
201 (Secret): Created
401: Unauthorized
patch
部分更新指定的 Secret
HTTP 请求
PATCH /api/v1/namespaces/{namespace}/secrets/{name}
参数
-
name (路径参数): string,必需
Secret 的名称
-
namespace (路径参数): string,必需
-
body: Patch,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (Secret): OK
201 (Secret): Created
401: Unauthorized
delete
删除 Secret
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/secrets/{name}
参数
-
name (路径参数): string,必需
Secret 的名称
-
namespace (路径参数): string,必需
-
body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 Secret 的集合
HTTP 请求
DELETE /api/v1/namespaces/{namespace}/secrets
参数
-
namespace (路径参数): string,必需
-
body: DeleteOptions
-
continue (查询参数): string
-
dryRun (查询参数): string
-
fieldSelector (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
响应
200 (Status): OK
401: Unauthorized
3 - CSIDriver
apiVersion: storage.k8s.io/v1
import "k8s.io/api/storage/v1"
CSIDriver
CSIDriver 抓取集群上部署的容器存储接口(CSI)卷驱动有关的信息。 Kubernetes 挂接/解除挂接控制器使用此对象来决定是否需要挂接。 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),必需
CSI 驱动的规约。
CSIDriverSpec
CSIDriverSpec 是 CSIDriver 的规约。
-
attachRequired (boolean)
attachRequired 表示这个 CSI 卷驱动需要挂接操作 (因为它实现了 CSI ControllerPublishVolume() 方法), Kubernetes 挂接/解除挂接控制器应调用挂接卷接口, 以检查卷挂接(volumeattachment)状态并在继续挂载之前等待卷被挂接。 CSI 外部挂接器与 CSI 卷驱动配合使用,并在挂接操作完成时更新 volumeattachment 状态。 如果 CSIDriverRegistry 特性门控被启用且此值指定为 false,将跳过挂接操作。 否则将调用挂接操作。
此字段不可变更。
-
fsGroupPolicy (string)
定义底层卷是否支持在挂载之前更改卷的所有权和权限。 有关更多详细信息,请参考特定的 FSGroupPolicy 值。
此字段不可变更。
默认为 ReadWriteOnceWithFSType,这会检查每个卷,以决定 Kubernetes 是否应修改卷的所有权和权限。 采用默认策略时,如果定义了 fstype 且卷的访问模式包含 ReadWriteOnce,将仅应用定义的 fsGroup。
-
podInfoOnMount (boolean)
如果设为 true,则 podInfoOnMount 表示在挂载操作期间这个 CSI 卷需要更多的 Pod 信息(例如 podName 和 podUID 等)。 如果设为 false,则挂载时将不传递 Pod 信息。 默认为 false。 CSI 驱动将 podInfoOnMount 指定为驱动部署的一部分。 如果为 true,Kubelet 将在 CSI NodePublishVolume() 调用中作为 VolumeContext 传递 Pod 信息。 CSI 驱动负责解析和校验作为 VolumeContext 传递进来的信息。 如果 podInfoOnMount 设为 true,将传递以下 VolumeConext。 此列表可能变大,但将使用前缀。
- "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 不支持此字段,所以在这类集群上部署驱动时,只能支持一种模式。 该部署就决定了是哪种模式,例如通过驱动的命令行参数。
此字段不可变更。
-
requiresRepublish (boolean)
requiresRepublish 表示 CSI 驱动想要
NodePublishVolume
被周期性地调用, 以反映已挂载卷中的任何可能的变化。 此字段默认为 false。注:成功完成对 NodePublishVolume 的初始调用后,对 NodePublishVolume 的后续调用只应更新卷的内容。 新的挂载点将不会被运行的容器察觉。
-
storageCapacity (boolean)
如果设为 true,则 storageCapacity 表示 CSI 卷驱动希望 Pod 调度时考虑存储容量, 驱动部署将通过创建包含容量信息的 CSIStorageCapacity 对象来报告该存储容量。
部署驱动时可以立即启用这个检查。 这种情况下,只有此驱动部署已发布某些合适的 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": <expiration timestamp in RFC3339>, }, ... }
注:每个 tokenRequest 中的受众应该不同,且最多有一个令牌是空字符串。 要在令牌过期后接收一个新的令牌,requiresRepublish 可用于周期性地触发 NodePublishVolume。
-
tokenRequests.audience (string),必需
audience 是 “TokenRequestSpec” 中令牌的目标受众。 它默认为 kube apiserver 的受众。
-
tokenRequests.expirationSeconds (int64)
expirationSeconds 是 “TokenRequestSpec” 中令牌的有效期。 它具有与 “TokenRequestSpec” 中 “expirationSeconds” 相同的默认值。
-
volumeLifecycleModes ([]string)
集合:唯一值将在合并期间被保留
volumeLifecycleModes 定义这个 CSI 卷驱动支持哪种类别的卷。 如果列表为空,则默认值为 “Persistent”,这是 CSI 规范定义的用法, 并通过常用的 PV/PVC 机制在 Kubernetes 中实现。 另一种模式是 “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),必需
items 是 CSIDriver 的列表。
操作
get
读取指定的 CSIDriver
HTTP 请求
GET /apis/storage.k8s.io/v1/csidrivers/{name}
参数
-
name (路径参数): string,必需
CSIDriver 的名称
-
pretty (查询参数): string
响应
200 (CSIDriver): OK
401: Unauthorized
list
列出或观测类别为 CSIDriver 的对象
HTTP 请求
GET /apis/storage.k8s.io/v1/csidrivers
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (CSIDriverList): OK
401: Unauthorized
create
创建 CSIDriver
HTTP 请求
POST /apis/storage.k8s.io/v1/csidrivers
参数
-
body: CSIDriver,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (CSIDriver): OK
201 (CSIDriver): Created
202 (CSIDriver): Accepted
401: Unauthorized
update
替换指定的 CSIDriver
HTTP 请求
PUT /apis/storage.k8s.io/v1/csidrivers/{name}
参数
-
name (路径参数): string,必需
CSIDriver 的名称
-
body: CSIDriver,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (CSIDriver): OK
201 (CSIDriver): Created
401: Unauthorized
patch
部分更新指定的 CSIDriver
HTTP 请求
PATCH /apis/storage.k8s.io/v1/csidrivers/{name}
参数
-
name (路径参数): string,必需
CSIDriver 的名称
-
body: Patch,必需
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (CSIDriver): OK
201 (CSIDriver): Created
401: Unauthorized
delete
删除 CSIDriver
HTTP 请求
DELETE /apis/storage.k8s.io/v1/csidrivers/{name}
参数
-
name (路径参数): string,必需
CSIDriver 的名称
-
body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (CSIDriver): OK
202 (CSIDriver): Accepted
401: Unauthorized
deletecollection
删除 CSIDriver 的集合
HTTP 请求
DELETE /apis/storage.k8s.io/v1/csidrivers
参数
-
body: DeleteOptions
-
continue (查询参数): string
-
dryRun (查询参数): string
-
fieldSelector (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
响应
200 (Status): OK
401: Unauthorized