工作负载资源
- 1: ControllerRevision
- 2: HorizontalPodAutoscaler
- 3: HorizontalPodAutoscaler
- 4: HorizontalPodAutoscaler v2beta2
- 5: PriorityClass
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 - HorizontalPodAutoscaler
apiVersion: autoscaling/v2
import "k8s.io/api/autoscaling/v2"
HorizontalPodAutoscaler
HorizontalPodAutoscaler 是水平 Pod 自动扩缩器的配置, 它根据指定的指标自动管理实现 scale 子资源的任何资源的副本数。
-
apiVersion: autoscaling/v2
-
kind: HorizontalPodAutoscaler
-
metadata (ObjectMeta)
metadata 是标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
spec (HorizontalPodAutoscalerSpec)
spec 是自动扩缩器行为的规约。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
-
status (HorizontalPodAutoscalerStatus)
status 是自动扩缩器的当前信息。
HorizontalPodAutoscalerSpec
HorizontalPodAutoscalerSpec 描述了 HorizontalPodAutoscaler 预期的功能。
-
maxReplicas (int32),必需
maxReplicas 是自动扩缩器可以扩容的副本数的上限。不能小于 minReplicas。
-
scaleTargetRef (CrossVersionObjectReference),必需
scaleTargetRef 指向要扩缩的目标资源,用于收集 Pod 的相关指标信息以及实际更改的副本数。
CrossVersionObjectReference 包含足够的信息来让你识别出所引用的资源。
-
scaleTargetRef.kind (string),必需
被引用对象的类别;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
-
scaleTargetRef.name (string),必需
被引用对象的名称;更多信息: https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/names/#names
-
scaleTargetRef.apiVersion (string)
被引用对象的 API 版本。
-
-
minReplicas (int32)
minReplicas 是自动扩缩器可以缩减的副本数的下限。它默认为 1 个 Pod。 如果启用了 Alpha 特性门控 HPAScaleToZero 并且配置了至少一个 Object 或 External 度量指标, 则 minReplicas 允许为 0。只要至少有一个度量值可用,扩缩就处于活动状态。
-
behavior (HorizontalPodAutoscalerBehavior)
behavior 配置目标在扩容(Up)和缩容(Down)两个方向的扩缩行为(分别用 scaleUp 和 scaleDown 字段)。 如果未设置,则会使用默认的 HPAScalingRules 进行扩缩容。
HorizontalPodAutoscalerBehavior 配置目标在扩容(Up)和缩容(Down)两个方向的扩缩行为 (分别用 scaleUp 和 scaleDown 字段)。
-
behavior.scaleDown (HPAScalingRules)
scaleDown 是缩容策略。如果未设置,则默认值允许缩减到 minReplicas 数量的 Pod, 具有 300 秒的稳定窗口(使用最近 300 秒的最高推荐值)。
HPAScalingRules 为一个方向配置扩缩行为。在根据 HPA 的指标计算 desiredReplicas 后应用这些规则。 可以通过指定扩缩策略来限制扩缩速度。可以通过指定稳定窗口来防止抖动, 因此不会立即设置副本数,而是选择稳定窗口中最安全的值。
-
behavior.scaleDown.policies ([]HPAScalingPolicy)
原子性:将在合并时被替换
policies 是可在扩缩容过程中使用的潜在扩缩策略的列表。必须至少指定一个策略,否则 HPAScalingRules 将被视为无效而丢弃。
HPAScalingPolicy 是一个单一的策略,它必须在指定的过去时间间隔内保持为 true。
-
behavior.scaleDown.policies.type (string),必需
type 用于指定扩缩策略。
-
behavior.scaleDown.policies.value (int32),必需
value 包含策略允许的更改量。它必须大于零。
-
behavior.scaleDown.policies.periodSeconds (int32),必需
periodSeconds 表示策略应该保持为 true 的时间窗口长度。 periodSeconds 必须大于零且小于或等于 1800(30 分钟)。
-
-
behavior.scaleDown.selectPolicy (string)
selectPolicy 用于指定应该使用哪个策略。如果未设置,则使用默认值 Max。
-
behavior.scaleDown.stabilizationWindowSeconds (int32)
stabilizationWindowSeconds 是在扩缩容时应考虑的之前建议的秒数。stabilizationWindowSeconds 必须大于或等于零且小于或等于 3600(一小时)。如果未设置,则使用默认值:
- 扩容:0(不设置稳定窗口)。
- 缩容:300(即稳定窗口为 300 秒)。
-
-
behavior.scaleUp (HPAScalingRules)
scaleUp 是用于扩容的扩缩策略。如果未设置,则默认值为以下值中的较高者:
- 每 60 秒增加不超过 4 个 Pod
- 每 60 秒 Pod 数量翻倍
不使用稳定窗口。
HPAScalingRules 为一个方向配置扩缩行为。在根据 HPA 的指标计算 desiredReplicas 后应用这些规则。 可以通过指定扩缩策略来限制扩缩速度。可以通过指定稳定窗口来防止抖动, 因此不会立即设置副本数,而是选择稳定窗口中最安全的值。
-
behavior.scaleUp.policies ([]HPAScalingPolicy)
原子性:将在合并时被替换
policies 是可在扩缩容过程中使用的潜在扩缩策略的列表。必须至少指定一个策略,否则 HPAScalingRules 将被视为无效而丢弃。
HPAScalingPolicy 是一个单一的策略,它必须在指定的过去时间间隔内保持为 true。
-
behavior.scaleUp.policies.type (string),必需
type 用于指定扩缩策略。
-
behavior.scaleUp.policies.value (int32),必需
value 包含策略允许的更改量。它必须大于零。
-
behavior.scaleUp.policies.periodSeconds (int32),必需
periodSeconds 表示策略应该保持为 true 的时间窗口长度。 periodSeconds 必须大于零且小于或等于 1800(30 分钟)。
-
-
behavior.scaleUp.selectPolicy (string)
selectPolicy 用于指定应该使用哪个策略。如果未设置,则使用默认值 Max。
-
behavior.scaleUp.stabilizationWindowSeconds (int32)
stabilizationWindowSeconds 是在扩缩容时应考虑的之前建议的秒数。stabilizationWindowSeconds 必须大于或等于零且小于或等于 3600(一小时)。如果未设置,则使用默认值:
- 扩容:0(不设置稳定窗口)。
- 缩容:300(即稳定窗口为 300 秒)。
-
-
metrics ([]MetricSpec)
原子性:将在合并时被替换
metrics 包含用于计算预期副本数的规约(将使用所有指标的最大副本数)。 预期副本数是通过将目标值与当前值之间的比率乘以当前 Pod 数来计算的。 因此,使用的指标必须随着 Pod 数量的增加而减少,反之亦然。 有关每种类别的指标必须如何响应的更多信息,请参阅各个指标源类别。 如果未设置,默认指标将设置为 80% 的平均 CPU 利用率。
MetricSpec 指定如何基于单个指标进行扩缩容(一次只能设置
type
和一个其他匹配字段)-
metrics.type (string),必需
type 是指标源的类别。它取值是 “ContainerResource”、“External”、“Object”、“Pods” 或 “Resource” 之一, 每个类别映射到对象中的一个对应的字段。注意:“ContainerResource” 类别在特性门控 HPAContainerMetrics 启用时可用。
-
metrics.containerResource (ContainerResourceMetricSource)
containerResource 是指 Kubernetes 已知的资源指标(例如在请求和限制中指定的那些), 描述当前扩缩目标中每个 Pod 中的单个容器(例如 CPU 或内存)。 此类指标内置于 Kubernetes 中,在使用 “pods” 源的、按 Pod 计算的普通指标之外,还具有一些特殊的扩缩选项。 这是一个 Alpha 特性,可以通过 HPAContainerMetrics 特性标志启用。
ContainerResourceMetricSource 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。在与目标值比较之前,这些值先计算平均值。 此类指标内置于 Kubernetes 中,并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。 只应设置一种 “target” 类别。
-
metrics.containerResource.container (string),必需
container 是扩缩目标的 Pod 中容器的名称。
-
metrics.containerResource.name (string),必需
name 是相关资源的名称。
-
metrics.containerResource.target (MetricTarget),必需
target 指定给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.containerResource.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.containerResource.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.containerResource.target.averageValue (Quantity)
是跨所有相关 Pod 的指标均值的目标值(以数量形式给出)。
-
metrics.containerResource.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.external (ExternalMetricSource)
external 指的是不与任何 Kubernetes 对象关联的全局指标。 这一字段允许基于来自集群外部运行的组件(例如云消息服务中的队列长度,或来自运行在集群外部的负载均衡器的 QPS)的信息进行自动扩缩容。
ExternalMetricSource 指示如何基于 Kubernetes 对象无关的指标 (例如云消息传递服务中的队列长度,或来自集群外部运行的负载均衡器的 QPS)执行扩缩操作。
-
metrics.external.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
metrics.external.metric.name (string),必需
name 是给定指标的名称。
-
metrics.external.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
metrics.external.target (MetricTarget),必需
target 指定给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.external.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.external.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得到的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.external.target.averageValue (Quantity)
averageValue 是跨所有相关 Pod 得到的指标均值的目标值(以数量形式给出)。
-
metrics.external.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.object (ObjectMetricSource)
object 是指描述单个 Kubernetes 对象的指标(例如,Ingress 对象上的
hits-per-second
)。ObjectMetricSource 表示如何根据描述 Kubernetes 对象的指标进行扩缩容(例如,Ingress 对象的
hits-per-second
)-
metrics.object.describedObject (CrossVersionObjectReference),必需
describeObject 表示对象的描述,如对象的
kind
、name
、apiVersion
。CrossVersionObjectReference 包含足够的信息来让你识别所引用的资源。
-
metrics.object.describedObject.kind (string),必需
被引用对象的类别;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"。
-
metrics.object.describedObject.name (string),必需
被引用对象的名称;更多信息: https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/names/#names
-
metrics.object.describedObject.apiVersion (string)
被引用对象的 API 版本。
-
-
metrics.object.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
metrics.object.metric.name (string),必需
name 是给定指标的名称。
-
metrics.object.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
metrics.object.target (MetricTarget),必需
target 表示给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.object.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.object.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.object.target.averageValue (Quantity)
averageValue 是跨所有 Pod 得出的指标均值的目标值(以数量形式给出)。
-
metrics.object.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.pods (PodsMetricSource)
pods 是指描述当前扩缩目标中每个 Pod 的指标(例如,
transactions-processed-per-second
)。 在与目标值进行比较之前,这些指标值将被平均。PodsMetricSource 表示如何根据描述当前扩缩目标中每个 Pod 的指标进行扩缩容(例如,
transactions-processed-per-second
)。 在与目标值进行比较之前,这些指标值将被平均。-
metrics.pods.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
metrics.pods.metric.name (string),必需
name 是给定指标的名称。
-
metrics.pods.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
metrics.pods.target (MetricTarget),必需
target 表示给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.pods.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.pods.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.pods.target.averageValue (Quantity)
averageValue 是跨所有 Pod 得出的指标均值的目标值(以数量形式给出)。
-
metrics.pods.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.resource (ResourceMetricSource)
resource 是指 Kubernetes 已知的资源指标(例如在请求和限制中指定的那些), 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。此类指标内置于 Kubernetes 中, 并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
ResourceMetricSource 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。在与目标值比较之前,这些指标值将被平均。 此类指标内置于 Kubernetes 中,并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。 只应设置一种 “target” 类别。
-
metrics.resource.name (string),必需
name 是相关资源的名称。
-
metrics.resource.target (MetricTarget),必需
target 指定给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.resource.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.resource.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.resource.target.averageValue (Quantity)
averageValue 是跨所有 Pod 得出的指标均值的目标值(以数量形式给出)。
-
metrics.resource.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
HorizontalPodAutoscalerStatus
HorizontalPodAutoscalerStatus 描述了水平 Pod 自动扩缩器的当前状态。
-
desiredReplicas (int32),必需
desiredReplicas 是此自动扩缩器管理的 Pod 的所期望的副本数,由自动扩缩器最后计算。
-
conditions ([]HorizontalPodAutoscalerCondition)
补丁策略:基于键
type
合并Map:合并时将保留 type 键的唯一值
conditions 是此自动扩缩器扩缩其目标所需的一组条件,并指示是否满足这些条件。
HorizontalPodAutoscalerCondition 描述 HorizontalPodAutoscaler 在某一时间点的状态。
-
conditions.status (string),必需
status 是状况的状态(True、False、Unknown)。
-
conditions.type (string),必需
type 描述当前状况。
-
conditions.lastTransitionTime (Time)
lastTransitionTime 是状况最近一次从一种状态转换到另一种状态的时间。
Time 是对 time.Time 的封装。Time 支持对 YAML 和 JSON 进行正确封包。为 time 包的许多函数方法提供了封装器。
-
conditions.message (string)
message 是一个包含有关转换的可读的详细信息。
-
conditions.reason (string)
reason 是状况最后一次转换的原因。
-
-
currentMetrics ([]MetricStatus)
原子性:将在合并期间被替换
currentMetrics 是此自动扩缩器使用的指标的最后读取状态。
MetricStatus 描述了单个指标的最后读取状态。
-
currentMetrics.type (string),必需
type 是指标源的类别。它取值是 “ContainerResource”、“External”、“Object”、“Pods” 或 “Resource” 之一, 每个类别映射到对象中的一个对应的字段。注意:“ContainerResource” 类别在特性门控 HPAContainerMetrics 启用时可用。
-
currentMetrics.containerResource (ContainerResourceMetricStatus)
containerResource 是指 Kubernetes 已知的一种资源指标(例如在请求和限制中指定的那些), 描述当前扩缩目标中每个 Pod 中的单个容器(例如 CPU 或内存)。 此类指标内置于 Kubernetes 中,并且在使用 "Pods" 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
ContainerResourceMetricStatus 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。此类指标内置于 Kubernetes 中, 并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
-
currentMetrics.containerResource.container (string),必需
container 是扩缩目标的 Pod 中的容器名称。
-
currentMetrics.containerResource.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.containerResource.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.containerResource.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.containerResource.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.containerResource.name (string),必需
name 是相关资源的名称。
-
-
currentMetrics.external (ExternalMetricStatus)
external 指的是不与任何 Kubernetes 对象关联的全局指标。这一字段允许基于来自集群外部运行的组件 (例如云消息服务中的队列长度,或来自集群外部运行的负载均衡器的 QPS)的信息进行自动扩缩。
ExternalMetricStatus 表示与任何 Kubernetes 对象无关的全局指标的当前值。
-
currentMetrics.external.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.external.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.external.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.external.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.external.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
currentMetrics.external.metric.name (string),必需
name 是给定指标的名称。
-
currentMetrics.external.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
-
currentMetrics.object (ObjectMetricStatus)
object 是指描述单个 Kubernetes 对象的指标(例如,Ingress 对象的
hits-per-second
)。ObjectMetricStatus 表示描述 Kubernetes 对象的指标的当前值(例如,Ingress 对象的
hits-per-second
)。-
currentMetrics.object.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.object.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.object.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.object.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.object.describedObject (CrossVersionObjectReference),必需
describeObject 表示对象的描述,如对象的
kind
、name
、apiVersion
。CrossVersionObjectReference 包含足够的信息来让你识别所引用的资源。
-
currentMetrics.object.describedObject.kind (string),必需
被引用对象的类别;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
-
currentMetrics.object.describedObject.name (string),必需
被引用对象的名称;更多信息: https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/names/#names
-
currentMetrics.object.describedObject.apiVersion (string)
被引用对象的 API 版本。
-
-
currentMetrics.object.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
currentMetrics.object.metric.name (string),必需
name 是给定指标的名称。
-
currentMetrics.object.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
-
currentMetrics.pods (PodsMetricStatus)
pods 是指描述当前扩缩目标中每个 Pod 的指标(例如,
transactions-processed-per-second
)。 在与目标值进行比较之前,这些指标值将被平均。PodsMetricStatus 表示描述当前扩缩目标中每个 Pod 的指标的当前值(例如,
transactions-processed-per-second
)。-
currentMetrics.pods.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.pods.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.pods.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.pods.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.pods.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
currentMetrics.pods.metric.name (string),必需
name 是给定指标的名称。
-
currentMetrics.pods.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
-
currentMetrics.resource (ResourceMetricStatus)
resource 是指 Kubernetes 已知的资源指标(例如在请求和限制中指定的那些), 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。此类指标内置于 Kubernetes 中, 并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
ResourceMetricSource 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。在与目标值比较之前,这些指标值将被平均。 此类指标内置于 Kubernetes 中,并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
-
currentMetrics.resource.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.resource.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值, 表示为 Pod 资源请求值的百分比。
-
currentMetrics.resource.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.resource.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.resource.name (string),必需
name 是相关资源的名称。
-
-
-
currentReplicas (int32)
currentReplicas 是此自动扩缩器管理的 Pod 的当前副本数,如自动扩缩器最后一次看到的那样。
-
lastScaleTime (Time)
lastScaleTime 是 HorizontalPodAutoscaler 上次扩缩 Pod 数量的时间,自动扩缩器使用它来控制更改 Pod 数量的频率。
Time 是对 time.Time 的封装。Time 支持对 YAML 和 JSON 进行正确封包。为 time 包的许多函数方法提供了封装器。
-
observedGeneration (int64)
observedGeneration 是此自动扩缩器观察到的最新一代。
HorizontalPodAutoscalerList
HorizontalPodAutoscalerList 是水平 Pod 自动扩缩器对象列表。
-
apiVersion: autoscaling/v2
-
kind: HorizontalPodAutoscalerList
-
metadata (ListMeta)
metadata 是标准的列表元数据。
-
items ([]HorizontalPodAutoscaler),必需
items 是水平 Pod 自动扩缩器对象的列表。
Operations
get
读取指定的 HorizontalPodAutoscaler
HTTP 请求
GET /apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
-
name (路径参数): string,必需
HorizontalPodAutoscaler 的名称。
响应
200 (HorizontalPodAutoscaler): OK
401: Unauthorized
get
读取指定 HorizontalPodAutoscaler 的状态
HTTP 请求
GET /apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status
参数
-
name (路径参数): string,必需
HorizontalPodAutoscaler 的名称。
响应
200 (HorizontalPodAutoscaler): OK
401: Unauthorized
list
列出或观察 HorizontalPodAutoscaler 类别的对象
HTTP 请求
GET /apis/autoscaling/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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/v2/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
4 - HorizontalPodAutoscaler v2beta2
apiVersion: autoscaling/v2beta2
import "k8s.io/api/autoscaling/v2beta2"
HorizontalPodAutoscaler
HorizontalPodAutoscaler 是水平 Pod 自动扩缩器的配置, 它根据指定的指标自动管理实现 scale 子资源的任何资源的副本数。
-
apiVersion: autoscaling/v2beta2
-
kind: HorizontalPodAutoscaler
-
metadata (ObjectMeta)
metadata 是标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
spec (HorizontalPodAutoscalerSpec)
spec 是自动扩缩器行为的规约。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
-
status (HorizontalPodAutoscalerStatus)
status 是自动扩缩器的当前信息。
HorizontalPodAutoscalerSpec
HorizontalPodAutoscalerSpec 描述了 HorizontalPodAutoscaler 预期的功能。
-
maxReplicas (int32),必需
maxReplicas 是自动扩缩器可以扩容的副本数的上限。不能小于 minReplicas。
-
scaleTargetRef (CrossVersionObjectReference),必需
scaleTargetRef 指向要扩缩的目标资源,用于收集 Pod 的相关指标信息以及实际更改的副本数。
CrossVersionObjectReference 包含足够的信息来让你识别出所引用的资源。
-
scaleTargetRef.kind (string),必需
被引用对象的类别;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
-
scaleTargetRef.name (string),必需
被引用对象的名称;更多信息: https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/names/#names
-
scaleTargetRef.apiVersion (string)
被引用对象的 API 版本。
-
-
minReplicas (int32)
minReplicas 是自动扩缩器可以缩减的副本数的下限。它默认为 1 个 Pod。 如果启用了 Alpha 特性门控 HPAScaleToZero 并且配置了至少一个 Object 或 External 度量指标, 则 minReplicas 允许为 0。只要至少有一个度量值可用,扩缩就处于活动状态。
-
behavior (HorizontalPodAutoscalerBehavior)
behavior 配置目标在扩容(Up)和缩容(Down)两个方向的扩缩行为(分别用 scaleUp 和 scaleDown 字段)。 如果未设置,则会使用默认的 HPAScalingRules 进行扩缩容。
HorizontalPodAutoscalerBehavior 配置目标在扩容(Up)和缩容(Down)两个方向的扩缩行为 (分别用 scaleUp 和 scaleDown 字段)。
-
behavior.scaleDown (HPAScalingRules)
scaleDown 是缩容策略。如果未设置,则默认值允许缩减到 minReplicas 数量的 Pod, 具有 300 秒的稳定窗口(使用最近 300 秒的最高推荐值)。
HPAScalingRules 为一个方向配置扩缩行为。在根据 HPA 的指标计算 desiredReplicas 后应用这些规则。 可以通过指定扩缩策略来限制扩缩速度。可以通过指定稳定窗口来防止抖动, 因此不会立即设置副本数,而是选择稳定窗口中最安全的值。
-
behavior.scaleDown.policies ([]HPAScalingPolicy)
policies 是可在扩缩容过程中使用的潜在扩缩策略的列表。必须至少指定一个策略,否则 HPAScalingRules 将被视为无效而丢弃。
HPAScalingPolicy 是一个单一的策略,它必须在指定的过去时间间隔内保持为 true。
-
behavior.scaleDown.policies.type (string),必需
type 用于指定扩缩策略。
-
behavior.scaleDown.policies.value (int32),必需
value 包含策略允许的更改量。它必须大于零。
-
behavior.scaleDown.policies.periodSeconds (int32),必需
periodSeconds 表示策略应该保持为 true 的时间窗口长度。 periodSeconds 必须大于零且小于或等于 1800(30 分钟)。
-
-
behavior.scaleDown.selectPolicy (string)
selectPolicy 用于指定应该使用哪个策略。如果未设置,则使用默认值 MaxPolicySelect。
-
behavior.scaleDown.stabilizationWindowSeconds (int32)
stabilizationWindowSeconds 是在扩缩容时应考虑的之前建议的秒数。stabilizationWindowSeconds 必须大于或等于零且小于或等于 3600(一小时)。如果未设置,则使用默认值:
- 扩容:0(不设置稳定窗口)。
- 缩容:300(即稳定窗口为 300 秒)。
-
-
behavior.scaleUp (HPAScalingRules)
scaleUp 是用于扩容的扩缩策略。如果未设置,则默认值为以下值中的较高者:
- 每 60 秒增加不超过 4 个 Pod
- 每 60 秒 Pod 数量翻倍
不使用稳定窗口。
HPAScalingRules 为一个方向配置扩缩行为。在根据 HPA 的指标计算 desiredReplicas 后应用这些规则。 可以通过指定扩缩策略来限制扩缩速度。可以通过指定稳定窗口来防止抖动, 因此不会立即设置副本数,而是选择稳定窗口中最安全的值。
-
behavior.scaleUp.policies ([]HPAScalingPolicy)
policies 是可在扩缩容过程中使用的潜在扩缩策略的列表。必须至少指定一个策略,否则 HPAScalingRules 将被视为无效而丢弃。
HPAScalingPolicy 是一个单一的策略,它必须在指定的过去时间间隔内保持为 true。
-
behavior.scaleUp.policies.type (string),必需
type 用于指定扩缩策略。
-
behavior.scaleUp.policies.value (int32),必需
value 包含策略允许的更改量。它必须大于零。
-
behavior.scaleUp.policies.periodSeconds (int32),必需
periodSeconds 表示策略应该保持为 true 的时间窗口长度。 periodSeconds 必须大于零且小于或等于 1800(30 分钟)。
-
-
behavior.scaleUp.selectPolicy (string)
selectPolicy 用于指定应该使用哪个策略。如果未设置,则使用默认值 MaxPolicySelect。
-
behavior.scaleUp.stabilizationWindowSeconds (int32)
stabilizationWindowSeconds 是在扩缩容时应考虑的之前建议的秒数。stabilizationWindowSeconds 必须大于或等于零且小于或等于 3600(一小时)。如果未设置,则使用默认值:
- 扩容:0(不设置稳定窗口)。
- 缩容:300(即稳定窗口为 300 秒)。
-
-
metrics ([]MetricSpec)
metrics 包含用于计算预期副本数的规约(将使用所有指标的最大副本数)。 预期副本数是通过将目标值与当前值之间的比率乘以当前 Pod 数来计算的。 因此,使用的指标必须随着 Pod 数量的增加而减少,反之亦然。 有关每种类别的指标必须如何响应的更多信息,请参阅各个指标源类别。 如果未设置,默认指标将设置为 80% 的平均 CPU 利用率。
MetricSpec 指定如何基于单个指标进行扩缩容(一次只能设置
type
和一个其他匹配字段)-
metrics.type (string),必需
type 是指标源的类别。它取值是 “ContainerResource”、“External”、“Object”、“Pods” 或 “Resource” 之一, 每个类别映射到对象中的一个对应的字段。注意:“ContainerResource” 类别在特性门控 HPAContainerMetrics 启用时可用。
-
metrics.containerResource (ContainerResourceMetricSource)
containerResource 是指 Kubernetes 已知的资源指标(例如在请求和限制中指定的那些), 描述当前扩缩目标中每个 Pod 中的单个容器(例如 CPU 或内存)。 此类指标内置于 Kubernetes 中,在使用 “pods” 源的、按 Pod 计算的普通指标之外,还具有一些特殊的扩缩选项。 这是一个 Alpha 特性,可以通过 HPAContainerMetrics 特性标志启用。
ContainerResourceMetricSource 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。在与目标值比较之前,这些值先计算平均值。 此类指标内置于 Kubernetes 中,并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。 只应设置一种 “target” 类别。
-
metrics.containerResource.container (string),必需
container 是扩缩目标的 Pod 中容器的名称。
-
metrics.containerResource.name (string),必需
name 是相关资源的名称。
-
metrics.containerResource.target (MetricTarget),必需
target 指定给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.containerResource.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.containerResource.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.containerResource.target.averageValue (Quantity)
是跨所有相关 Pod 的指标均值的目标值(以数量形式给出)。
-
metrics.containerResource.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.external (ExternalMetricSource)
external 指的是不与任何 Kubernetes 对象关联的全局指标。 这一字段允许基于来自集群外部运行的组件(例如云消息服务中的队列长度,或来自运行在集群外部的负载均衡器的 QPS)的信息进行自动扩缩容。
ExternalMetricSource 指示如何基于 Kubernetes 对象无关的指标 (例如云消息传递服务中的队列长度,或来自集群外部运行的负载均衡器的 QPS)执行扩缩操作。
-
metrics.external.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
metrics.external.metric.name (string),必需
name 是给定指标的名称。
-
metrics.external.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
metrics.external.target (MetricTarget),必需
target 指定给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.external.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.external.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得到的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.external.target.averageValue (Quantity)
averageValue 是跨所有相关 Pod 得到的指标均值的目标值(以数量形式给出)。
-
metrics.external.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.object (ObjectMetricSource)
object 是指描述单个 Kubernetes 对象的指标(例如,Ingress 对象上的
hits-per-second
)。ObjectMetricSource 表示如何根据描述 Kubernetes 对象的指标进行扩缩容(例如,Ingress 对象的
hits-per-second
)-
metrics.object.describedObject (CrossVersionObjectReference),必需
CrossVersionObjectReference 包含足够的信息来让你识别所引用的资源。
-
metrics.object.describedObject.kind (string),必需
被引用对象的类别;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"。
-
metrics.object.describedObject.name (string),必需
被引用对象的名称;更多信息: https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/names/#names
-
metrics.object.describedObject.apiVersion (string)
被引用对象的 API 版本。
-
-
metrics.object.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
metrics.object.metric.name (string),必需
name 是给定指标的名称。
-
metrics.object.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
metrics.object.target (MetricTarget),必需
target 表示给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.object.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.object.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.object.target.averageValue (Quantity)
averageValue 是跨所有 Pod 得出的指标均值的目标值(以数量形式给出)。
-
metrics.object.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.pods (PodsMetricSource)
pods 是指描述当前扩缩目标中每个 Pod 的指标(例如,
transactions-processed-per-second
)。 在与目标值进行比较之前,这些指标值将被平均。PodsMetricSource 表示如何根据描述当前扩缩目标中每个 Pod 的指标进行扩缩容(例如,
transactions-processed-per-second
)。 在与目标值进行比较之前,这些指标值将被平均。-
metrics.pods.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
metrics.pods.metric.name (string),必需
name 是给定指标的名称。
-
metrics.pods.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
metrics.pods.target (MetricTarget),必需
target 表示给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.pods.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.pods.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.pods.target.averageValue (Quantity)
averageValue 是跨所有 Pod 得出的指标均值的目标值(以数量形式给出)。
-
metrics.pods.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
metrics.resource (ResourceMetricSource)
resource 是指 Kubernetes 已知的资源指标(例如在请求和限制中指定的那些), 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。此类指标内置于 Kubernetes 中, 并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
ResourceMetricSource 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。在与目标值比较之前,这些指标值将被平均。 此类指标内置于 Kubernetes 中,并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。 只应设置一种 “target” 类别。
-
metrics.resource.name (string),必需
name 是相关资源的名称。
-
metrics.resource.target (MetricTarget),必需
target 指定给定指标的目标值。
MetricTarget 定义特定指标的目标值、平均值或平均利用率
-
metrics.resource.target.type (string),必需
type 表示指标类别是
Utilization
、Value
或AverageValue
。
-
metrics.resource.target.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的目标值, 表示为 Pod 资源请求值的百分比。目前仅对 “Resource” 指标源类别有效。
-
metrics.resource.target.averageValue (Quantity)
averageValue 是跨所有 Pod 得出的指标均值的目标值(以数量形式给出)。
-
metrics.resource.target.value (Quantity)
value 是指标的目标值(以数量形式给出)。
-
-
-
HorizontalPodAutoscalerStatus
HorizontalPodAutoscalerStatus 描述了水平 Pod 自动扩缩器的当前状态。
-
currentReplicas (int32),必需
currentReplicas 是此自动扩缩器管理的 Pod 的当前副本数,如自动扩缩器最后一次看到的那样。
-
desiredReplicas (int32),必需
desiredReplicas 是此自动扩缩器管理的 Pod 的所期望的副本数,由自动扩缩器最后计算。
-
conditions ([]HorizontalPodAutoscalerCondition)
conditions 是此自动扩缩器扩缩其目标所需的一组条件,并指示是否满足这些条件。
HorizontalPodAutoscalerCondition 描述 HorizontalPodAutoscaler 在某一时间点的状态。
-
conditions.status (string),必需
status 是状况的状态(True、False、Unknown)。
-
conditions.type (string),必需
type 描述当前状况。
-
conditions.lastTransitionTime (Time)
lastTransitionTime 是状况最近一次从一种状态转换到另一种状态的时间。
Time 是对 time.Time 的封装。Time 支持对 YAML 和 JSON 进行正确封包。为 time 包的许多函数方法提供了封装器。
-
conditions.message (string)
message 是一个包含有关转换的可读的详细信息。
-
conditions.reason (string)
reason 是状况最后一次转换的原因。
-
-
currentMetrics ([]MetricStatus)
currentMetrics 是此自动扩缩器使用的指标的最后读取状态。
MetricStatus 描述了单个指标的最后读取状态。
-
currentMetrics.type (string),必需
type 是指标源的类别。它取值是 “ContainerResource”、“External”、“Object”、“Pods” 或 “Resource” 之一, 每个类别映射到对象中的一个对应的字段。注意:“ContainerResource” 类别在特性门控 HPAContainerMetrics 启用时可用。
-
currentMetrics.containerResource (ContainerResourceMetricStatus)
containerResource 是指 Kubernetes 已知的一种资源指标(例如在请求和限制中指定的那些), 描述当前扩缩目标中每个 Pod 中的单个容器(例如 CPU 或内存)。 此类指标内置于 Kubernetes 中,并且在使用 "Pods" 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
ContainerResourceMetricStatus 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。此类指标内置于 Kubernetes 中, 并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
-
currentMetrics.containerResource.container (string),必需
container 是扩缩目标的 Pod 中的容器名称。
-
currentMetrics.containerResource.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.containerResource.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.containerResource.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.containerResource.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.containerResource.name (string),必需
name 是相关资源的名称。
-
-
currentMetrics.external (ExternalMetricStatus)
external 指的是不与任何 Kubernetes 对象关联的全局指标。这一字段允许基于来自集群外部运行的组件 (例如云消息服务中的队列长度,或来自集群外部运行的负载均衡器的 QPS)的信息进行自动扩缩。
ExternalMetricStatus 表示与任何 Kubernetes 对象无关的全局指标的当前值。
-
currentMetrics.external.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.external.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.external.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.external.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.external.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
currentMetrics.external.metric.name (string),必需
name 是给定指标的名称。
-
currentMetrics.external.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
-
currentMetrics.object (ObjectMetricStatus)
object 是指描述单个 Kubernetes 对象的指标(例如,Ingress 对象的
hits-per-second
)。ObjectMetricStatus 表示描述 Kubernetes 对象的指标的当前值(例如,Ingress 对象的
hits-per-second
)。-
currentMetrics.object.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.object.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.object.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.object.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.object.describedObject (CrossVersionObjectReference),必需
CrossVersionObjectReference 包含足够的信息来让你识别所引用的资源。
-
currentMetrics.object.describedObject.kind (string),必需
被引用对象的类别;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
-
currentMetrics.object.describedObject.name (string),必需
被引用对象的名称;更多信息: https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/names/#names
-
currentMetrics.object.describedObject.apiVersion (string)
被引用对象的 API 版本。
-
-
currentMetrics.object.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
currentMetrics.object.metric.name (string),必需
name 是给定指标的名称。
-
currentMetrics.object.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
-
currentMetrics.pods (PodsMetricStatus)
pods 是指描述当前扩缩目标中每个 Pod 的指标(例如,
transactions-processed-per-second
)。 在与目标值进行比较之前,这些指标值将被平均。PodsMetricStatus 表示描述当前扩缩目标中每个 Pod 的指标的当前值(例如,
transactions-processed-per-second
)。-
currentMetrics.pods.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.pods.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值,表示为 Pod 资源请求值的百分比。
-
currentMetrics.pods.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.pods.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.pods.metric (MetricIdentifier),必需
metric 通过名称和选择算符识别目标指标。
MetricIdentifier 定义指标的名称和可选的选择算符
-
currentMetrics.pods.metric.name (string),必需
name 是给定指标的名称。
-
currentMetrics.pods.metric.selector (LabelSelector)
selector 是给定指标的标准 Kubernetes 标签选择算符的字符串编码形式。 设置后,它作为附加参数传递给指标服务器,以获取更具体的指标范围。 未设置时,仅 metricName 参数将用于收集指标。
-
-
-
currentMetrics.resource (ResourceMetricStatus)
resource 是指 Kubernetes 已知的资源指标(例如在请求和限制中指定的那些), 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。此类指标内置于 Kubernetes 中, 并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
ResourceMetricSource 指示如何根据请求和限制中指定的 Kubernetes 已知的资源指标进行扩缩容, 此结构描述当前扩缩目标中的每个 Pod(例如 CPU 或内存)。在与目标值比较之前,这些指标值将被平均。 此类指标内置于 Kubernetes 中,并且在使用 “Pods” 源的、按 Pod 统计的普通指标之外支持一些特殊的扩缩选项。
-
currentMetrics.resource.current (MetricValueStatus),必需
current 包含给定指标的当前值。
MetricValueStatus 保存指标的当前值
-
currentMetrics.resource.current.averageUtilization (int32)
averageUtilization 是跨所有相关 Pod 得出的资源指标均值的当前值, 表示为 Pod 资源请求值的百分比。
-
currentMetrics.resource.current.averageValue (Quantity)
averageValue 是跨所有相关 Pod 的指标均值的当前值(以数量形式给出)。
-
currentMetrics.resource.current.value (Quantity)
value 是指标的当前值(以数量形式给出)。
-
-
currentMetrics.resource.name (string),必需
name 是相关资源的名称。
-
-
-
lastScaleTime (Time)
lastScaleTime 是 HorizontalPodAutoscaler 上次扩缩 Pod 数量的时间,自动扩缩器使用它来控制更改 Pod 数量的频率。
Time 是对 time.Time 的封装。Time 支持对 YAML 和 JSON 进行正确封包。为 time 包的许多函数方法提供了封装器。
-
observedGeneration (int64)
observedGeneration 是此自动扩缩器观察到的最新一代。
HorizontalPodAutoscalerList
HorizontalPodAutoscalerList 是水平 Pod 自动扩缩器对象列表。
-
apiVersion: autoscaling/v2beta2
-
kind: HorizontalPodAutoscalerList
-
metadata (ListMeta)
metadata 是标准的列表元数据。
-
items ([]HorizontalPodAutoscaler),必需
items 是水平 Pod 自动扩缩器对象的列表。
Operations
get
读取指定的 HorizontalPodAutoscaler
HTTP 请求
GET /apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
-
name (路径参数): string,必需
HorizontalPodAutoscaler 的名称。
响应
200 (HorizontalPodAutoscaler): OK
401: Unauthorized
get
读取指定 HorizontalPodAutoscaler 的状态
HTTP 请求
GET /apis/autoscaling/v2beta2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status
参数
-
name (路径参数): string,必需
HorizontalPodAutoscaler 的名称。
响应
200 (HorizontalPodAutoscaler): OK
401: Unauthorized
list
列出或观察 HorizontalPodAutoscaler 类别的对象
HTTP 请求
GET /apis/autoscaling/v2beta2/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/v2beta2/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/v2beta2/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/v2beta2/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/v2beta2/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/v2beta2/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/v2beta2/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/v2beta2/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/v2beta2/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
5 - 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