您正在查看 Kubernetes 版本的文档: v1.24

Kubernetes v1.24 版本的文档已不再维护。您现在看到的版本来自于一份静态的快照。如需查阅最新文档,请点击 最新版本。

HorizontalPodAutoscaler

水平 Pod 自动缩放器的配置。

<-- 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

HorizontalPodAutoscalerSpec

水平 Pod 自动缩放器的规约。


  • maxReplicas (int32),必填

    自动扩缩器可以设置的 Pod 数量上限; 不能小于 minReplicas。

  • 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)

    标准的列表元数据。

操作


get 读取特定的 HorizontalPodAutoscaler

HTTP 请求

GET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}

参数

  • name路径参数): string,必填

    HorizontalPodAutoscaler 的名称。

  • namespace路径参数): string,必填

    namespace

  • pretty查询参数): string

    pretty

响应

200 (HorizontalPodAutoscaler): OK

401: Unauthorized

get 读取特定 HorizontalPodAutoscaler 的状态

HTTP 请求

GET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}/status

参数

  • name路径参数): string,必填

    HorizontalPodAutoscaler 的名称。

  • namespace路径参数): string,必填

    namespace

  • pretty查询参数): string

    pretty

响应

200 (HorizontalPodAutoscaler): OK

401: Unauthorized

list 列出或监视 HorizontalPodAutoscaler 类别的对象

HTTP 参数

GET /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers

参数

  • namespace路径参数): string,必填

    namespace

  • continue查询参数): string

    continue

  • limit查询参数): integer

    limit

  • pretty查询参数): string

    pretty

  • watch查询参数): boolean

    watch

响应

200 (HorizontalPodAutoscalerList): OK

401: Unauthorized

list 列出或监视 HorizontalPodAutoscaler 类别的对象

HTTP 请求

GET /apis/autoscaling/v1/horizontalpodautoscalers

参数

  • continue (查询参数*): string

    continue

  • limit查询参数): integer

    limit

  • pretty查询参数): string

    pretty

  • watch查询参数): boolean

    watch

响应

200 (HorizontalPodAutoscalerList): OK

401: Unauthorized

create 创建一个 HorizontalPodAutoscaler

HTTP 请求

POST /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers

参数

  • namespace路径参数): string,必填

    namespace

  • dryRun查询参数): string

    dryRun

  • pretty查询参数): string

    pretty

响应

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,必填

    namespace

  • dryRun查询参数): string

    dryRun

  • pretty查询参数): string

    pretty

响应

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,必填

    namespace

  • dryRun查询参数): string

    dryRun

  • pretty查询参数): string

    pretty

响应

200 (HorizontalPodAutoscaler): OK

201 (HorizontalPodAutoscaler): Created

401: Unauthorized

patch 部分更新特定的 HorizontalPodAutoscaler

HTTP 请求

PATCH /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}

参数

  • name路径参数): string,必填

    HorizontalPodAutoscaler 的名称

  • namespace路径参数): string,必填

    namespace

  • dryRun查询参数): string

    dryRun

  • force查询参数): boolean

    force

  • pretty查询参数): string

    pretty

响应

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,必填

    namespace

  • dryRun查询参数): string

    dryRun

  • force查询参数): boolean

    force

  • pretty查询参数): string

    pretty

响应

200 (HorizontalPodAutoscaler): OK

201 (HorizontalPodAutoscaler): Created

401: Unauthorized

delete 删除一个 HorizontalPodAutoscaler

HTTP 请求

DELETE /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers/{name}

参数

  • name路径参数): string,必填

    HorizontalPodAutoscaler 的名称

  • namespace路径参数): string,必填

    namespace

  • dryRun查询参数): string

    dryRun

  • pretty查询参数): string

    pretty

响应

200 (Status): OK

202 (Status): Accepted

401: Unauthorized

deletecollection 删除 HorizontalPodAutoscaler 的集合

HTTP 请求

DELETE /apis/autoscaling/v1/namespaces/{namespace}/horizontalpodautoscalers

参数

  • namespace路径参数): string,必填

    namespace

  • continue查询参数): string

    continue

  • dryRun查询参数): string

    dryRun

  • limit查询参数): integer

    limit

  • pretty查询参数): string

    pretty

响应

200 (Status): OK

401: Unauthorized