PodDisruptionBudget

PodDisruptionBudget 是一个对象,用于定义对一组 Pod 可能造成的最大中断。

apiVersion: policy/v1

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

PodDisruptionBudget

PodDisruptionBudget 是一个对象,用于定义对一组 Pod 可能造成的最大中断


PodDisruptionBudgetSpec

PodDisruptionBudgetSpec 是 PodDisruptionBudget 的描述。


  • maxUnavailable (IntOrString)

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

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

  • minAvailable (IntOrString)

    如果在驱逐后,由 "selector" 选择的至少 "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"),但尚未健康的 Pod 只有在受保护的应用程序没有中断(status.currentHealthy 至少等于 status.desiredHealthy)的情况下才能被驱逐。健康的 Pod 将受 PDB 驱逐的影响。

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

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

    此字段处于 beta 级别。当功能门 PDBUnhealthyPodEvictionPolicy 启用(默认启用)时,驱逐 API 使用此字段。

PodDisruptionBudgetStatus

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


  • currentHealthy (int32), required

    当前健康 Pod 的数量

  • desiredHealthy (int32), required

    最小期望的健康 Pod 数量

  • disruptionsAllowed (int32), required

    当前允许的 Pod 中断数量。

  • expectedPods (int32), required

    此中断预算计算的 Pod 总数

  • conditions ([]Condition)

    补丁策略:按键 type 合并

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

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

    • InsufficientPods:Pod 数量等于或低于 PodDisruptionBudget 所需的数量。不允许中断,条件状态将为 False。
    • SufficientPods:Pod 数量超过 PodDisruptionBudget 所需的数量。条件将为 True,并且允许的中断数量由 disruptionsAllowed 属性提供。

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

    • conditions.lastTransitionTime (Time), required

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

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

    • conditions.message (string), required

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

    • conditions.reason (string), required

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

    • conditions.status (string), required

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

    • conditions.type (string), required

      条件类型,驼峰式或 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, required

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, required

    命名空间

  • pretty (在查询中): string

    pretty

响应

200 (PodDisruptionBudget): OK

401: Unauthorized

get 读取指定 PodDisruptionBudget 的状态

HTTP 请求

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

参数

  • name (在路径中): string, required

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, required

    命名空间

  • 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, required

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, required

    命名空间

  • body: Patch, required

  • 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, required

    PodDisruptionBudget 的名称

  • namespace (在路径中): string, required

    命名空间

  • body: Patch, required

  • 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

200 (状态): 已接受

401: Unauthorized

deletecollection 删除 PodDisruptionBudget 集合

HTTP 请求

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

参数

响应

200 (Status): OK

401: Unauthorized

此页面是自动生成的。

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

最后修改时间:2023 年 4 月 3 日,太平洋标准时间上午 8:22:API Ref 多页 v1.27 (7b39e9a9ec)