PodDisruptionBudget

PodDisruptionBudget 是一个对象,用于定义对一组 pod 可造成的最大破坏。

apiVersion: policy/v1

import "k8s.io/api/policy/v1"

PodDisruptionBudget

PodDisruptionBudget 是一个对象,用于定义对一组 pod 可造成的最大破坏


PodDisruptionBudgetSpec

PodDisruptionBudgetSpec 是 PodDisruptionBudget 的描述。


  • maxUnavailable (IntOrString)

    如果在驱逐后,由 "selector" 选择的 pod 中最多有 "maxUnavailable" 个 pod 不可使用,则允许驱逐,即即使在没有被驱逐的 pod 的情况下也是如此。例如,可以通过指定 0 来阻止所有自愿驱逐。这是一个与 "minAvailable" 相互排斥的设置。

    IntOrString 是一种可以保存 int32 或字符串的类型。在 JSON 或 YAML 序列化和反序列化时,它会生成或使用内部类型。这允许你拥有例如可以接受名称或数字的 JSON 字段。

  • minAvailable (IntOrString)

    如果在驱逐后,由 "selector" 选择的 pod 中至少有 "minAvailable" 个 pod 仍然可用,则允许驱逐,即即使在没有被驱逐的 pod 的情况下也是如此。因此,例如,可以通过指定 "100%" 来阻止所有自愿驱逐。

    IntOrString 是一种可以保存 int32 或字符串的类型。在 JSON 或 YAML 序列化和反序列化时,它会生成或使用内部类型。这允许你拥有例如可以接受名称或数字的 JSON 字段。

  • selector (LabelSelector)

    对 pod 的标签查询,这些 pod 的驱逐由破坏预算管理。空选择器将不匹配任何 pod,而空 ({}) 选择器将选择命名空间内的所有 pod。

  • unhealthyPodEvictionPolicy (string)

    UnhealthyPodEvictionPolicy 定义了何时应考虑将不健康的 pod 驱逐的标准。当前实现将健康的 pod 视为具有类型为 "Ready"、状态为 "True" 的 status.conditions 项的 pod。

    有效的策略是 IfHealthyBudget 和 AlwaysAllow。如果未指定策略,将使用默认行为,这对应于 IfHealthyBudget 策略。

    IfHealthyBudget 策略意味着正在运行的 pod (status.phase="Running"),但尚未处于健康状态,只有在受保护的应用程序未受到破坏 (status.currentHealthy 至少等于 status.desiredHealthy) 时才能被驱逐。健康的 pod 将受到 PDB 驱逐的影响。

    AlwaysAllow 策略意味着所有正在运行的 pod (status.phase="Running"),但尚未处于健康状态,都被视为已破坏,并且可以被驱逐,无论是否满足 PDB 中的标准。这意味着被破坏的应用程序的预期运行 pod 可能没有机会变得健康。健康的 pod 将受到 PDB 驱逐的影响。

    将来可能会添加其他策略。如果在该字段中遇到无法识别的策略,做出驱逐决定的客户端应禁止驱逐不健康的 pod。

    此字段处于测试阶段。当功能门 PDBUnhealthyPodEvictionPolicy 启用 (默认情况下启用) 时,驱逐 API 使用此字段。

PodDisruptionBudgetStatus

PodDisruptionBudgetStatus 表示有关 PodDisruptionBudget 状态的信息。状态可能落后于系统的实际状态。


  • currentHealthy (int32), 必需

    当前健康 pod 的数量

  • desiredHealthy (int32), 必需

    健康的 pod 的最小期望数量

  • disruptionsAllowed (int32), 必需

    当前允许的 pod 驱逐次数。

  • expectedPods (int32), 必需

    此破坏预算统计的 pod 的总数

  • conditions ([]Condition)

    补丁策略:在键 type 上合并

    映射:合并期间将保留键类型上的唯一值

    Conditions 包含 PDB 的条件。破坏控制器设置 DisruptionAllowed 条件。以下是 reason 字段的已知值 (将来可能会添加其他原因):- SyncFailed:控制器遇到错误,无法计算允许的破坏次数。因此,不允许进行任何破坏,条件状态将为 False。

    • InsufficientPods:pod 数量已达到或低于 PodDisruptionBudget 所需的数量。不允许进行任何破坏,条件状态将为 False。
    • SufficientPods:pod 数量超过 PodDisruptionBudget 所需的数量。条件将为 True,并且允许的破坏次数由 disruptionsAllowed 属性提供。

    Condition 包含有关此 API 资源当前状态的一个方面的详细信息。

    • conditions.lastTransitionTime (Time), 必需

      lastTransitionTime 是条件从一种状态转换为另一种状态的最后时间。这应该是底层条件发生变化时。如果不知道,则使用 API 字段发生变化的时间是可以接受的。

      Time 是 time.Time 的包装器,支持对 YAML 和 JSON 的正确序列化。为 time 包提供的许多工厂方法提供了包装器。

    • conditions.message (string), 必需

      message 是一个可读的文本,指示有关转换的详细信息。这可能是一个空字符串。

    • conditions.reason (string), 必需

      reason 包含一个程序标识符,指示条件最后转换的原因。特定条件类型的生产者可能会为此字段定义预期的值和含义,以及这些值是否被视为保证的 API。该值应为 CamelCase 字符串。此字段不能为空。

    • conditions.status (string), 必需

      条件的状态,为 True、False 或 Unknown 之一。

    • conditions.type (string), 必需

      条件的类型,以 CamelCase 或 foo.example.com/CamelCase 表示。

    • conditions.observedGeneration (int64)

      observedGeneration 表示设置条件时所依据的 .metadata.generation。例如,如果 .metadata.generation 当前为 12,但 .status.conditions[x].observedGeneration 为 9,则该条件相对于实例的当前状态而言已过时。

  • disruptedPods (map[string]Time)

    DisruptedPods 包含有关 pod 的信息,这些 pod 的驱逐已由 API 服务器驱逐子资源处理程序处理,但尚未被 PodDisruptionBudget 控制器观察到。从 API 服务器处理驱逐请求的时间到 pod 被 PDB 控制器视为已标记为删除 (或在超时后) 的时间,pod 将在此映射中。映射中的键是 pod 的名称,值为 API 服务器处理驱逐请求的时间。如果删除未发生且 pod 仍然存在,它将在一段时间后由 PodDisruptionBudget 控制器自动从列表中删除。如果一切顺利,此映射在大多数情况下应为空。映射中大量条目可能表示 pod 删除存在问题。

    Time 是 time.Time 的包装器,支持对 YAML 和 JSON 的正确序列化。为 time 包提供的许多工厂方法提供了包装器。

  • observedGeneration (int64)

    更新此 PDB 状态时观察到的最新代。DisruptionsAllowed 和其他状态信息仅在 observedGeneration 等于 PDB 的对象代时才有效。

PodDisruptionBudgetList

PodDisruptionBudgetList 是 PodDisruptionBudget 的集合。


操作


get 读取指定的 PodDisruptionBudget

HTTP 请求

GET /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}

参数

  • name (在路径中): string, 必需

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, 必需

    命名空间

  • pretty (在查询中): string

    pretty

响应

200 (PodDisruptionBudget): OK

401: Unauthorized

get 读取指定 PodDisruptionBudget 的状态

HTTP 请求

GET /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status

参数

  • name (在路径中): string, 必需

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, 必需

    命名空间

  • pretty (在查询中): string

    pretty

响应

200 (PodDisruptionBudget): OK

401: Unauthorized

list 列出或监视 PodDisruptionBudget 类型的对象

HTTP 请求

GET /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets

参数

响应

200 (PodDisruptionBudgetList): OK

401: Unauthorized

list 列出或监视 PodDisruptionBudget 类型的对象

HTTP 请求

GET /apis/policy/v1/poddisruptionbudgets

参数

响应

200 (PodDisruptionBudgetList): OK

401: Unauthorized

create 创建 PodDisruptionBudget

HTTP 请求

POST /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets

参数

响应

200 (PodDisruptionBudget): OK

201 (PodDisruptionBudget): Created

202 (PodDisruptionBudget): Accepted

401: Unauthorized

update 替换指定的 PodDisruptionBudget

HTTP 请求

PUT /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}

参数

响应

200 (PodDisruptionBudget): OK

201 (PodDisruptionBudget): Created

401: Unauthorized

update 替换指定 PodDisruptionBudget 的状态

HTTP 请求

PUT /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status

参数

响应

200 (PodDisruptionBudget): OK

201 (PodDisruptionBudget): Created

401: Unauthorized

patch 部分更新指定的 PodDisruptionBudget

HTTP 请求

PATCH /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}

参数

  • name (在路径中): string, 必需

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, 必需

    命名空间

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (在查询中): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (PodDisruptionBudget): OK

201 (PodDisruptionBudget): Created

401: Unauthorized

patch 部分更新指定 PodDisruptionBudget 的状态

HTTP 请求

PATCH /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}/status

参数

  • name (在路径中): string, 必需

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, 必需

    命名空间

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (在查询中): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (PodDisruptionBudget): OK

201 (PodDisruptionBudget): Created

401: Unauthorized

delete 删除 PodDisruptionBudget

HTTP 请求

DELETE /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets/{name}

参数

响应

200 (Status): OK

202 (Status): Accepted

401: Unauthorized

deletecollection 删除 PodDisruptionBudget 集合

HTTP 请求

DELETE /apis/policy/v1/namespaces/{namespace}/poddisruptionbudgets

参数

响应

200 (Status): OK

401: Unauthorized

此页面由系统自动生成。

如果您要报告此页面出现问题,请在您的问题描述中提及此页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。

最后修改时间:2023 年 4 月 3 日 下午 8:22 PST: API Ref 多页面 v1.27 (7b39e9a9ec)