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),必需
kind 是引用对象的类型;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
scaleTargetRef.name (string),必需
name 是引用对象的名称;更多信息: https://kubernetes.ac.cn/docs/concepts/overview/working-with-objects/names/#names
scaleTargetRef.apiVersion (string)
apiVersion 是引用对象的 API 版本
minReplicas (int32)
minReplicas 是自动扩缩器可以缩减到的副本数量的下限。它默认为 1 个 Pod。如果启用了 alpha 特性门控 HPAScaleToZero 且至少配置了一个对象(Object)或外部(External)度量指标,则 minReplicas 允许为 0。只要至少有一个度量值可用,扩缩就处于活动状态。
behavior (HorizontalPodAutoscalerBehavior)
behavior 配置目标在扩容(scaleUp)和缩容(scaleDown)两个方向上的扩缩行为(分别通过 scaleUp 和 scaleDown 字段)。如果未设置,则使用默认的 HPAScalingRules 进行扩容和缩容。
HorizontalPodAutoscalerBehavior 配置目标在扩容(scaleUp)和缩容(scaleDown)两个方向上的扩缩行为。
behavior.scaleDown (HPAScalingRules)
scaleDown 是缩容策略。如果未设置,默认值是允许缩容到 minReplicas 个 Pod,并设置 300 秒的稳定窗口(即,使用最近 300 秒内的最高推荐值)。
*HPAScalingRules 通过扩缩策略规则和可配置的度量容差来配置一个方向上的扩缩行为。
扩缩策略规则在 HPA 根据度量指标计算出 DesiredReplicas 后应用。它们可以通过指定扩缩策略来限制扩缩速度。它们可以通过指定稳定窗口来防止抖动,这样副本数量就不会立即设置,而是从稳定窗口中选择最安全的值。
容差应用于度量值,防止因度量值的微小变化而过于积极地扩缩。(请注意,设置容差需要启用 alpha HPAConfigurableTolerance 特性门控。)*
behavior.scaleDown.policies ([]HPAScalingPolicy)
原子性:在合并期间将被替换
policies 是扩缩期间可以使用的潜在扩缩策略列表。如果未设置,使用默认值:- 对于扩容:允许在 15 秒窗口内将 Pod 数量翻倍,或者绝对增加 4 个 Pod。- 对于缩容:允许在 15 秒窗口内移除所有 Pod。
HPAScalingPolicy 是一个必须在指定过去时间间隔内保持为真的单一策略。
behavior.scaleDown.policies.type (string),必需
type 用于指定扩缩策略。
behavior.scaleDown.policies.value (int32),必需
value 包含策略允许的更改量。它必须大于零。
behavior.scaleDown.policies.periodSeconds (int32),必需
periodSeconds 指定策略应保持为真的时间窗口。PeriodSeconds 必须大于零且小于或等于 1800(30 分钟)。
behavior.scaleDown.selectPolicy (string)
selectPolicy 用于指定应使用哪个策略。如果未设置,则使用默认值 Max。
behavior.scaleDown.stabilizationWindowSeconds (int32)
stabilizationWindowSeconds 是在扩容或缩容时应考虑过去推荐值的秒数。StabilizationWindowSeconds 必须大于或等于零且小于或等于 3600(一小时)。如果未设置,使用默认值:- 对于扩容:0(即不进行稳定处理)。- 对于缩容:300(即稳定窗口为 300 秒)。
behavior.scaleDown.tolerance (Quantity)
tolerance 是当前度量值与所需度量值之间比率的容差,在此容差范围内不对所需副本数量进行更新(例如,1% 的容差为 0.01)。必须大于或等于零。如果未设置,则应用默认的集群范围容差(默认为 10%)。
例如,如果自动扩缩配置的内存消耗目标为 100Mi,缩容容差为 5%,扩容容差为 1%,则当实际消耗低于 95Mi 或超过 101Mi 时将触发扩缩。
这是一个 alpha 字段,需要启用 HPAConfigurableTolerance 特性门控。
behavior.scaleUp (HPAScalingRules)
scaleUp 是扩容策略。如果未设置,默认值是以下两者中的较大者:
- 每 60 秒增加不超过 4 个 Pod
- 每 60 秒将 Pod 数量翻倍,不使用稳定机制。
*HPAScalingRules 通过扩缩策略规则和可配置的度量容差来配置一个方向上的扩缩行为。
扩缩策略规则在 HPA 根据度量指标计算出 DesiredReplicas 后应用。它们可以通过指定扩缩策略来限制扩缩速度。它们可以通过指定稳定窗口来防止抖动,这样副本数量就不会立即设置,而是从稳定窗口中选择最安全的值。
容差应用于度量值,防止因度量值的微小变化而过于积极地扩缩。(请注意,设置容差需要启用 alpha HPAConfigurableTolerance 特性门控。)*
behavior.scaleUp.policies ([]HPAScalingPolicy)
原子性:在合并期间将被替换
policies 是扩缩期间可以使用的潜在扩缩策略列表。如果未设置,使用默认值:- 对于扩容:允许在 15 秒窗口内将 Pod 数量翻倍,或者绝对增加 4 个 Pod。- 对于缩容:允许在 15 秒窗口内移除所有 Pod。
HPAScalingPolicy 是一个必须在指定过去时间间隔内保持为真的单一策略。
behavior.scaleUp.policies.type (string),必需
type 用于指定扩缩策略。
behavior.scaleUp.policies.value (int32),必需
value 包含策略允许的更改量。它必须大于零。
behavior.scaleUp.policies.periodSeconds (int32),必需
periodSeconds 指定策略应保持为真的时间窗口。PeriodSeconds 必须大于零且小于或等于 1800(30 分钟)。
behavior.scaleUp.selectPolicy (string)
selectPolicy 用于指定应使用哪个策略。如果未设置,则使用默认值 Max。
behavior.scaleUp.stabilizationWindowSeconds (int32)
stabilizationWindowSeconds 是在扩容或缩容时应考虑过去推荐值的秒数。StabilizationWindowSeconds 必须大于或等于零且小于或等于 3600(一小时)。如果未设置,使用默认值:- 对于扩容:0(即不进行稳定处理)。- 对于缩容:300(即稳定窗口为 300 秒)。
behavior.scaleUp.tolerance (Quantity)
tolerance 是当前度量值与所需度量值之间比率的容差,在此容差范围内不对所需副本数量进行更新(例如,1% 的容差为 0.01)。必须大于或等于零。如果未设置,则应用默认的集群范围容差(默认为 10%)。
例如,如果自动扩缩配置的内存消耗目标为 100Mi,缩容容差为 5%,扩容容差为 1%,则当实际消耗低于 95Mi 或超过 101Mi 时将触发扩缩。
这是一个 alpha 字段,需要启用 HPAConfigurableTolerance 特性门控。
metrics ([]MetricSpec)
原子性:在合并期间将被替换
metrics 包含用于计算所需副本数量的规范(将使用所有度量指标中的最大副本数量)。所需副本数量的计算方法是:目标值与当前值之间的比率乘以当前 Pod 数量。因此,使用的度量指标必须随着 Pod 数量的增加而减少,反之亦然。有关每种度量指标类型如何响应的更多信息,请参阅各个度量指标源类型。如果未设置,默认度量指标将设置为 80% 的平均 CPU 利用率。
MetricSpec 指定如何根据单个度量指标进行扩缩(应同时只设置
type
和一个其他匹配字段)。metrics.type (string),必需
type 是度量指标源的类型。它应该是 "ContainerResource"、"External"、"Object"、"Pods" 或 "Resource" 中的一个,每个都对应对象中一个匹配的字段。
metrics.containerResource (ContainerResourceMetricSource)
containerResource 指的是 Kubernetes 已知的资源度量(例如在请求和限制中指定的度量),它描述了当前扩缩目标中每个 Pod 的单个容器(例如 CPU 或内存)。此类度量指标内置于 Kubernetes,并且除了使用“pods”源的普通每 Pod 度量指标之外,还具有特殊的扩缩选项。
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 资源请求值的百分比。目前仅适用于资源度量指标源类型
metrics.containerResource.target.averageValue (Quantity)
averageValue 是所有相关 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 资源请求值的百分比。目前仅适用于资源度量指标源类型
metrics.external.target.averageValue (Quantity)
averageValue 是所有相关 Pod 的度量指标平均值的目标值(以数量表示)
metrics.external.target.value (Quantity)
value 是度量指标的目标值(以数量表示)。
metrics.object (ObjectMetricSource)
object 指的是描述单个 Kubernetes 对象的度量指标(例如,Ingress 对象的每秒命中数)。
ObjectMetricSource 指示如何根据描述 Kubernetes 对象的度量指标进行扩缩(例如,Ingress 对象的每秒命中数)。
metrics.object.describedObject (CrossVersionObjectReference),必需
describedObject 指定对象的描述,例如 kind、name apiVersion
CrossVersionObjectReference 包含足够的信息,让你能够识别所引用的资源。
metrics.object.describedObject.kind (string),必需
kind 是引用对象的类型;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metrics.object.describedObject.name (string),必需
name 是引用对象的名称;更多信息: https://kubernetes.ac.cn/docs/concepts/overview/working-with-objects/names/#names
metrics.object.describedObject.apiVersion (string)
apiVersion 是引用对象的 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 资源请求值的百分比。目前仅适用于资源度量指标源类型
metrics.object.target.averageValue (Quantity)
averageValue 是所有相关 Pod 的度量指标平均值的目标值(以数量表示)
metrics.object.target.value (Quantity)
value 是度量指标的目标值(以数量表示)。
metrics.pods (PodsMetricSource)
pods 指的是描述当前扩缩目标中每个 Pod 的度量指标(例如,每秒处理的事务数)。这些值将进行平均,然后与目标值进行比较。
PodsMetricSource 指示如何根据描述当前扩缩目标中每个 Pod 的度量指标进行扩缩(例如,每秒处理的事务数)。这些值将进行平均,然后与目标值进行比较。
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 资源请求值的百分比。目前仅适用于资源度量指标源类型
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 资源请求值的百分比。目前仅适用于资源度量指标源类型
metrics.resource.target.averageValue (Quantity)
averageValue 是所有相关 Pod 的度量指标平均值的目标值(以数量表示)
metrics.resource.target.value (Quantity)
value 是度量指标的目标值(以数量表示)。
HorizontalPodAutoscalerStatus
HorizontalPodAutoscalerStatus 描述了水平 Pod 自动扩缩器的当前状态。
desiredReplicas (int32),必需
desiredReplicas 是此自动扩缩器管理的 Pod 所期望的副本数量,由自动扩缩器最后计算。
conditions ([]HorizontalPodAutoscalerCondition)
补丁策略:按键
type
合并映射:合并时将保留键类型上的唯一值
conditions 是此自动扩缩器扩缩其目标所需的条件集,并指示这些条件是否满足。
HorizontalPodAutoscalerCondition 描述了 HorizontalPodAutoscaler 在某个时刻的状态。
conditions.status (string),必需
status 是条件的状态(True、False、Unknown)
conditions.type (string),必需
type 描述了当前条件
conditions.lastTransitionTime (Time)
lastTransitionTime 是条件上次从一种状态转换到另一种状态的时间
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" 中的一个,每个都对应对象中一个匹配的字段。
currentMetrics.containerResource (ContainerResourceMetricStatus)
container resource 指的是 Kubernetes 已知的资源度量(例如在请求和限制中指定的度量),它描述了当前扩缩目标中每个 Pod 的单个容器(例如 CPU 或内存)。此类度量指标内置于 Kubernetes,并且除了使用“pods”源的普通每 Pod 度量指标之外,还具有特殊的扩缩选项。
ContainerResourceMetricStatus 指示 Kubernetes 已知的资源度量指标的当前值,如请求和限制中指定的那样,描述了当前扩缩目标中每个 Pod 的单个容器(例如 CPU 或内存)。此类度量指标内置于 Kubernetes,并且除了使用“pods”源的普通每 Pod 度量指标之外,还具有特殊的扩缩选项。
currentMetrics.containerResource.container (string),必需
container 是扩缩目标中 Pod 的容器名称
currentMetrics.containerResource.current (MetricValueStatus),必需
current 包含给定度量指标的当前值
currentMetrics.containerResource.current.averageUtilization (int32)
currentAverageUtilization 是所有相关 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 包含给定度量指标的当前值
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 对象的每秒命中数)。
ObjectMetricStatus 指示描述 Kubernetes 对象的度量指标的当前值(例如,Ingress 对象的每秒命中数)。
currentMetrics.object.current (MetricValueStatus),必需
current 包含给定度量指标的当前值
currentMetrics.object.describedObject (CrossVersionObjectReference),必需
DescribedObject 指定对象的描述,例如 kind、name apiVersion
CrossVersionObjectReference 包含足够的信息,让你能够识别所引用的资源。
currentMetrics.object.describedObject.kind (string),必需
kind 是引用对象的类型;更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
currentMetrics.object.describedObject.name (string),必需
name 是引用对象的名称;更多信息: https://kubernetes.ac.cn/docs/concepts/overview/working-with-objects/names/#names
currentMetrics.object.describedObject.apiVersion (string)
apiVersion 是引用对象的 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 的度量指标(例如,每秒处理的事务数)。这些值将进行平均,然后与目标值进行比较。
PodsMetricStatus 指示描述当前扩缩目标中每个 Pod 的度量指标的当前值(例如,每秒处理的事务数)。
currentMetrics.pods.current (MetricValueStatus),必需
current 包含给定度量指标的当前值
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 度量指标之外,还具有特殊的扩缩选项。
ResourceMetricStatus 指示 Kubernetes 已知的资源度量指标的当前值,如请求和限制中指定的那样,描述了当前扩缩目标中每个 Pod 的资源(例如 CPU 或内存)。此类度量指标内置于 Kubernetes,并且除了使用“pods”源的普通每 Pod 度量指标之外,还具有特殊的扩缩选项。
currentMetrics.resource.current (MetricValueStatus),必需
current 包含给定度量指标的当前值
currentMetrics.resource.name (string),必需
name 是相关资源的名称。
currentReplicas (int32)
currentReplicas 是此自动扩缩器管理的 Pod 的当前副本数量,由自动扩缩器上次观测到。
lastScaleTime (Time)
lastScaleTime 是 HorizontalPodAutoscaler 上次扩缩 Pod 数量的时间,自动扩缩器使用它来控制 Pod 数量的更改频率。
Time 是 time.Time 的一个包装器,支持正确地编组到 YAML 和 JSON。提供了 time 包提供的许多工厂方法的包装器。
observedGeneration (int64)
observedGeneration 是此自动扩缩器观测到的最新一代。
HorizontalPodAutoscalerList
HorizontalPodAutoscalerList 是水平 Pod 自动扩缩器对象的列表。
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscalerList
metadata (ListMeta)
metadata 是标准的列表元数据。
items ([]HorizontalPodAutoscaler),必需
items 是水平 Pod 自动扩缩器对象的列表。
操作
get
读取指定的 HorizontalPodAutoscaler
HTTP 请求
GET /apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
name (在路径中): string,必填
HorizontalPodAutoscaler 的名称
namespace (在路径中): string,必填
pretty (在查询中): string
响应
200 (HorizontalPodAutoscaler): OK
401: 未授权
get
读取指定的 HorizontalPodAutoscaler 的状态
HTTP 请求
GET /apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}/status
参数
name (在路径中): string,必填
HorizontalPodAutoscaler 的名称
namespace (在路径中): string,必填
pretty (在查询中): string
响应
200 (HorizontalPodAutoscaler): OK
401: 未授权
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
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
watch (在查询中): boolean
响应
200 (HorizontalPodAutoscalerList): OK
401: 未授权
list
列出或监视 HorizontalPodAutoscaler 类型的对象
HTTP 请求
GET /apis/autoscaling/v2/horizontalpodautoscalers
参数
allowWatchBookmarks (在查询中): boolean
continue (在查询中): string
fieldSelector (在查询中): string
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
watch (在查询中): boolean
响应
200 (HorizontalPodAutoscalerList): OK
401: 未授权
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): 已创建
202 (HorizontalPodAutoscaler): 已接受
401: 未授权
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): 已创建
401: 未授权
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): 已创建
401: 未授权
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): 已创建
401: 未授权
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): 已创建
401: 未授权
delete
删除 HorizontalPodAutoscaler
HTTP 请求
DELETE /apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers/{name}
参数
name (在路径中): string,必填
HorizontalPodAutoscaler 的名称
namespace (在路径中): string,必填
body: DeleteOptions
dryRun (在查询中): string
gracePeriodSeconds (在查询中): integer
ignoreStoreReadErrorWithClusterBreakingPotential (在查询中): boolean
pretty (在查询中): string
propagationPolicy (在查询中): string
响应
200 (Status): OK
202 (Status): 已接受
401: 未授权
deletecollection
删除 HorizontalPodAutoscaler 集合
HTTP 请求
DELETE /apis/autoscaling/v2/namespaces/{namespace}/horizontalpodautoscalers
参数
namespace (在路径中): string,必填
body: DeleteOptions
continue (在查询中): string
dryRun (在查询中): string
fieldSelector (在查询中): string
gracePeriodSeconds (在查询中): integer
ignoreStoreReadErrorWithClusterBreakingPotential (在查询中): boolean
labelSelector (在查询中): string
limit (在查询中): integer
pretty (在查询中): string
propagationPolicy (在查询中): string
resourceVersion (在查询中): string
resourceVersionMatch (在查询中): string
sendInitialEvents (在查询中): boolean
timeoutSeconds (在查询中): integer
响应
200 (Status): OK
401: 未授权
本页面是自动生成的。
如果你打算报告此页面存在的问题,请在问题描述中提及此页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。