工作负载资源
1 - ControllerRevision
apiVersion: apps/v1
import "k8s.io/api/apps/v1"
ControllerRevision
ControllerRevision 实现了状态数据的不可变快照。 客户端负责序列化和反序列化对象,包含对象内部状态。 成功创建 ControllerRevision 后,将无法对其进行更新。 API 服务器将无法成功验证所有尝试改变 data 字段的请求。 但是,可以删除 ControllerRevisions。 请注意,由于 DaemonSet 和 StatefulSet 控制器都使用它来进行更新和回滚,所以这个对象是 beta 版。 但是,它可能会在未来版本中更改名称和表示形式,客户不应依赖其稳定性。 它主要供控制器内部使用。
- apiVersion: apps/v1
- kind: ControllerRevision
-
metadata (ObjectMeta)
标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
revision (int64),必需
revision 表示 data 表示的状态的修订。
-
data (RawExtension)
data 是状态的序列化表示。
要使用它,请生成一个字段,在外部、版本化结构中以 RawExtension 作为其类型,在内部结构中以 Object 作为其类型。
内部包:
type MyAPIObject struct { runtime.TypeMeta `json:",inline"` MyPlugin runtime.Object `json:"myPlugin"` } type PluginA struct { AOption string `json:"aOption"` }
外部包:
type MyAPIObject struct { runtime.TypeMeta `json:",inline"` MyPlugin runtime.RawExtension `json:"myPlugin"` } type PluginA struct { AOption string `json:"aOption"` }
在网络上,JSON 看起来像这样:
{ "kind":"MyAPIObject", "apiVersion":"v1", "myPlugin": { "kind":"PluginA", "aOption":"foo", }, }
那么会发生什么? 解码首先使用 json 或 yaml 将序列化数据解组到你的外部 MyAPIObject 中。 这会导致原始 JSON 被存储下来,但不会被解包。 下一步是复制(使用 pkg/conversion)到内部结构中。 runtime 包的 DefaultScheme 安装了转换函数,它将解析存储在 RawExtension 中的 JSON, 将其转换为正确的对象类型,并将其存储在 Object 中。 (TODO:如果对象是未知类型,将创建并存储一个
runtime.Unknown
对象。)
ControllerRevisionList
ControllerRevisionList 是一个包含 ControllerRevision 对象列表的资源。
- apiVersion: apps/v1
- kind: ControllerRevisionList
-
metadata (ListMeta)
更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
items ([]ControllerRevision),必需
items 是 ControllerRevisions 的列表
操作
get
读取特定的 ControllerRevision
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}
参数
-
name (路径参数):string,必需
ControllerRevision 的名称
-
namespace (路径参数):string,必需
-
pretty (查询参数):string
响应
200 (ControllerRevision): OK
401: Unauthorized
list
列出或监视 ControllerRevision 类别的对象
HTTP 请求
GET /apis/apps/v1/namespaces/{namespace}/controllerrevisions
参数
-
namespace (路径参数):string,必需
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数):string
-
fieldSelector (查询参数):string
-
labelSelector (查询参数):string
-
limit (查询参数)): integer
-
pretty (查询参数):string
-
resourceVersion (查询参数):string
-
resourceVersionMatch (查询参数):string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (ControllerRevisionList): OK
401: Unauthorized
list
列出或监视 ControllerRevision 类别的对象
HTTP 请求
GET /apis/apps/v1/controllerrevisions
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数):string
-
fieldSelector (查询参数):string
-
labelSelector (查询参数):string
-
limit (查询参数): integer
-
pretty (查询参数):string
-
resourceVersion (查询参数):string
-
resourceVersionMatch (查询参数):string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (ControllerRevisionList): OK
401: Unauthorized
create
创建一个 ControllerRevision
HTTP 请求
POST /apis/apps/v1/namespaces/{namespace}/controllerrevisions
参数
-
namespace (路径参数):string,必需
- body: ControllerRevision,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (ControllerRevision): OK
201 (ControllerRevision): Created
202 (ControllerRevision): Accepted
401: Unauthorized
update
替换特定的 ControllerRevision
HTTP 参数
PUT /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}
参数
-
name (路径参数):string,必需
ControllerRevision 的名称
-
namespace (路径参数):string,必需
- body: ControllerRevision,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (ControllerRevision): OK
201 (ControllerRevision): Created
401: Unauthorized
patch
部分更新特定的 ControllerRevision
HTTP 请求
PATCH /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}
参数
-
name (路径参数):string,必需
ControllerRevision 的名称
-
namespace (路径参数):string,必需
- body: Patch,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
force (查询参数): boolean
-
pretty (查询参数):string
响应
200 (ControllerRevision): OK
201 (ControllerRevision): Created
401: Unauthorized
delete
删除一个 ControllerRevision
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}
参数
-
name (路径参数):string,必需
ControllerRevision 的名称
-
namespace (路径参数):string,必需
- body: DeleteOptions
-
dryRun (查询参数):string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数):string
-
propagationPolicy (查询参数):string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 ControllerRevision 集合
HTTP 请求
DELETE /apis/apps/v1/namespaces/{namespace}/controllerrevisions
参数
-
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 - HorizontalPodAutoscaler
<-- api_metadata: apiVersion: "autoscaling/v1" import: "k8s.io/api/autoscaling/v1" kind: "HorizontalPodAutoscaler" content_type: "api_reference" description: "configuration of a horizontal pod autoscaler." title: "HorizontalPodAutoscaler" weight: 11 auto_generated: true -->
apiVersion: autoscaling/v1
import "k8s.io/api/autoscaling/v1"
HorizontalPodAutoscaler
水平 Pod 自动缩放器的配置。
-
apiVersion: autoscaling/v1
-
kind: HorizontalPodAutoscaler
-
metadata (ObjectMeta)
标准的对象元数据。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
spec (HorizontalPodAutoscalerSpec)
自动缩放器的规约。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
-
status (HorizontalPodAutoscalerStatus)
自动缩放器的当前信息。
HorizontalPodAutoscalerSpec
水平 Pod 自动缩放器的规约。
-
maxReplicas (int32),必填
自动扩缩器可以设置的 Pod 数量上限; 不能小于 minReplicas。
-
scaleTargetRef (CrossVersionObjectReference),必填
对被扩缩资源的引用; 水平 Pod 自动缩放器将了解当前的资源消耗,并使用其 scale 子资源设置所需的 Pod 数量。
CrossVersionObjectReference 包含足够的信息来让你识别出所引用的资源。
-
scaleTargetRef.kind (string),必填
被引用对象的类别; 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
-
scaleTargetRef.name (string),必填
被引用对象的名称; 更多信息: http://kubernetes.io/docs/user-guide/identifiers#names
-
scaleTargetRef.apiVersion (string)
被引用对象的 API 版本。
-
-
minReplicas (int32)
minReplicas 是自动缩放器可以缩减的副本数的下限。 它默认为 1 个 Pod。 如果启用了 alpha 特性门禁 HPAScaleToZero 并且配置了至少一个 Object 或 External 度量标准, 则 minReplicas 允许为 0。 只要至少有一个度量值可用,缩放就处于活动状态。
-
targetCPUUtilizationPercentage (int32)
所有 Pod 的目标平均 CPU 利用率(以请求 CPU 的百分比表示); 如果未指定,将使用默认的自动缩放策略。
HorizontalPodAutoscalerStatus
水平 Pod 自动缩放器的当前状态
-
currentReplicas (int32),必填
此自动缩放器管理的 Pod 的当前副本数。
-
desiredReplicas (int32),必填
此自动缩放器管理的 Pod 副本的所需数量。
-
currentCPUUtilizationPercentage (int32)
当前所有 Pod 的平均 CPU 利用率, 以请求 CPU 的百分比表示, 例如:70 表示平均 Pod 现在正在使用其请求 CPU 的 70%。
-
lastScaleTime (Time)
上次 HorizontalPodAutoscaler 缩放 Pod 的数量; 自动缩放器用它来控制 Pod 数量的更改频率。
Time 是 time.Time 的包装类,支持正确地序列化为 YAML 和 JSON。 为 time 包提供的许多工厂方法提供了包装类。
-
observedGeneration (int64)
此自动缩放器观察到的最新一代。
HorizontalPodAutoscalerList
水平 Pod 自动缩放器对象列表。
-
apiVersion: autoscaling/v1
-
kind: HorizontalPodAutoscalerList
-
metadata (ListMeta)
标准的列表元数据。
-
items ([]HorizontalPodAutoscaler), required
水平 Pod 自动缩放器对象的列表。
操作
get
读取特定的 HorizontalPodAutoscaler
HTTP 请求
GET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
-
name (路径参数): string,必填
HorizontalPodAutoscaler 的名称。
-
namespace (路径参数): string,必填
-
pretty (查询参数): string
响应
200 (HorizontalPodAutoscaler): OK
401: Unauthorized
get
读取特定 HorizontalPodAutoscaler 的状态
HTTP 请求
GET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status
参数
-
name (路径参数): string,必填
HorizontalPodAutoscaler 的名称。
-
namespace (路径参数): string,必填
-
pretty (查询参数): string
响应
200 (HorizontalPodAutoscaler): OK
401: Unauthorized
list
列出或监视 HorizontalPodAutoscaler 类别的对象
HTTP 参数
GET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers
参数
-
namespace (路径参数): string,必填
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数*): integer
-
watch (查询参数): boolean
响应
200 (HorizontalPodAutoscalerList): OK
401: Unauthorized
list
列出或监视 HorizontalPodAutoscaler 类别的对象
HTTP 请求
GET /apis/autoscaling/v1/horizontalpodautoscalers
参数
-
allowWatchBookmarks (查询参数): boolean
-
continue (查询参数*): string
-
fieldSelector (查询参数): string
-
labelSelector (查询参数): string
-
limit (查询参数): integer
-
pretty (查询参数): string
-
resourceVersion (查询参数): string
-
resourceVersionMatch (查询参数): string
-
timeoutSeconds (查询参数): integer
-
watch (查询参数): boolean
响应
200 (HorizontalPodAutoscalerList): OK
401: Unauthorized
create
创建一个 HorizontalPodAutoscaler
HTTP 请求
POST /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers
参数
-
namespace (路径参数): string,必填
- body: HorizontalPodAutoscaler,必填
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (HorizontalPodAutoscaler): OK
201 (HorizontalPodAutoscaler): Created
202 (HorizontalPodAutoscaler): Accepted
401: Unauthorized
update
替换特定的 HorizontalPodAutoscaler
HTTP 请求
PUT /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
-
name (路径参数): string,必填
HorizontalPodAutoscaler 的名称
-
namespace (路径参数): string,必填
- body: HorizontalPodAutoscaler,必填
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (HorizontalPodAutoscaler): OK
201 (HorizontalPodAutoscaler): Created
401: Unauthorized
update
替换特定 HorizontalPodAutoscaler 的状态
HTTP 请求
PUT /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status
参数
-
name (路径参数): string,必填
HorizontalPodAutoscaler 的名称
-
namespace (路径参数): string,必填
- body: HorizontalPodAutoscaler,必填
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
pretty (查询参数): string
响应
200 (HorizontalPodAutoscaler): OK
201 (HorizontalPodAutoscaler): Created
401: Unauthorized
patch
部分更新特定的 HorizontalPodAutoscaler
HTTP 请求
PATCH /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
-
name (路径参数): string,必填
HorizontalPodAutoscaler 的名称
-
namespace (路径参数): string,必填
- body: Patch,必填
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (HorizontalPodAutoscaler): OK
201 (HorizontalPodAutoscaler): Created
401: Unauthorized
patch
部分更新特定 HorizontalPodAutoscaler 的状态
HTTP 请求
PATCH /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status
参数
-
name (路径参数): string,必填
HorizontalPodAutoscaler 的名称
-
namespace (路径参数): string,必填
- body: Patch,必填
-
dryRun (查询参数): string
-
fieldManager (查询参数): string
-
fieldValidation (查询参数): string
-
force (查询参数): boolean
-
pretty (查询参数): string
响应
200 (HorizontalPodAutoscaler): OK
201 (HorizontalPodAutoscaler): Created
401: Unauthorized
delete
删除一个 HorizontalPodAutoscaler
HTTP 请求
DELETE /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
-
name (路径参数): string,必填
HorizontalPodAutoscaler 的名称
-
namespace (路径参数): string,必填
- body: DeleteOptions
-
dryRun (查询参数): string
-
gracePeriodSeconds (查询参数): integer
-
pretty (查询参数): string
-
propagationPolicy (查询参数): string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 HorizontalPodAutoscaler 的集合
HTTP 请求
DELETE /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers
参数
-
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 - PriorityClass
apiVersion: scheduling.k8s.io/v1
import "k8s.io/api/scheduling/v1"
PriorityClass
PriorityClass 定义了从优先级类名到优先级数值的映射。 该值可以是任何有效的整数。
- apiVersion: scheduling.k8s.io/v1
- kind: PriorityClass
-
metadata (ObjectMeta)
标准对象的元数据。 更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
value (int32),必需
此优先级的值。这是 Pod 在其 Pod 规约中有此类名称时收到的实际优先级。
-
description (string)
description 是一个任意字符串,通常提供有关何时应使用此优先级的指南。
-
globalDefault (boolean)
globalDefault 指定是否应将此 PriorityClass 视为没有任何优先级类的 pod 的默认优先级。 只有一个 PriorityClass 可以标记为
globalDefault
。 但是,如果存在多个 PriorityClasses 且其globalDefault
字段设置为 true, 则将使用此类全局默认 PriorityClasses 的最小值作为默认优先级。
-
preemptionPolicy (string)
PreemptionPolicy 是抢占优先级较低的 Pod 的策略。 可选值:Never、PreemptLowerPriority。 如果未设置,则默认为 PreemptLowerPriority。
PriorityClassList
PriorityClassList 是优先级类的集合。
- apiVersion: scheduling.k8s.io/v1
- kind: PriorityClassList
-
metadata (ListMeta)
标准列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
items ([]PriorityClass),必需
items 是 PriorityClasses 的列表
操作
get
读取特定的 PriorityClass
HTTP 请求
GET /apis/scheduling.k8s.io/v1/priorityclasses/{name}
参数
-
name (路径参数): string,必需
PriorityClass 名称
-
pretty (查询参数):string
响应
200 (PriorityClass): OK
401: Unauthorized
list
列出或观察 PriorityClass类的对象
HTTP 请求
GET /apis/scheduling.k8s.io/v1/priorityclasses
参数
-
allowWatchBookmarks (查询参数):boolean
-
continue (查询参数):string
-
fieldSelector (查询参数):string
-
labelSelector (查询参数):string
-
limit (查询参数):integer
-
pretty (查询参数):string
-
resourceVersion (查询参数):string
-
resourceVersionMatch (查询参数):string
-
timeoutSeconds (查询参数):integer
-
watch (查询参数):boolean
响应
200 (PriorityClassList): OK
401: Unauthorized
create
创建一个 PriorityClass
HTTP 请求
POST /apis/scheduling.k8s.io/v1/priorityclasses
参数
- body: PriorityClass,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (PriorityClass): OK
201 (PriorityClass): Created
202 (PriorityClass): Accepted
401: Unauthorized
update
替换指定的 PriorityClass
HTTP 请求
PUT /apis/scheduling.k8s.io/v1/priorityclasses/{name}
参数
-
name (路径参数): string,必需
PriorityClass 名称
- body: PriorityClass,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
pretty (查询参数):string
响应
200 (PriorityClass): OK
201 (PriorityClass): Created
401: Unauthorized
patch
部分更新特定的 PriorityClass
HTTP 请求
PATCH /apis/scheduling.k8s.io/v1/priorityclasses/{name}
参数
-
name (路径参数): string,必须
PriorityClass 名称
- body: Patch,必需
-
dryRun (查询参数):string
-
fieldManager (查询参数):string
-
fieldValidation (查询参数):string
-
force (查询参数):boolean
-
pretty (查询参数):string
响应
200 (PriorityClass): OK
201 (PriorityClass): Created
401: Unauthorized
delete
删除一个 PriorityClass
HTTP 请求
DELETE /apis/scheduling.k8s.io/v1/priorityclasses/{name}
参数
-
name (路径参数): string,必需
PriorityClass 名称。
- body: DeleteOptions
-
dryRun (查询参数):string
-
gracePeriodSeconds (查询参数):integer
-
pretty (查询参数):string
-
propagationPolicy (查询参数):string
响应
200 (Status): OK
202 (Status): Accepted
401: Unauthorized
deletecollection
删除 PriorityClass 集合
HTTP 请求
DELETE /apis/scheduling.k8s.io/v1/priorityclasses
参数
- 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