Lease

Lease 定义了一个 Lease 概念。

apiVersion: coordination.k8s.io/v1

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

Lease

Lease 定义了一个 Lease 概念。


LeaseSpec

LeaseSpec 是 Lease 的规范。


  • acquireTime (MicroTime)

    acquireTime 是当前 Lease 被获取的时间。

    MicroTime 是具有微秒级精度的 Time 版本。

  • holderIdentity (string)

    holderIdentity 包含当前 Lease 的持有者的身份。如果使用协调领导者选举,持有者身份必须等于被选举的 LeaseCandidate.metadata.name 字段。

  • leaseDurationSeconds (int32)

    leaseDurationSeconds 是候选者需要等待以强制获取 Lease 的时长。这是相对于上次观察到的 renewTime 测量的。

  • leaseTransitions (int32)

    leaseTransitions 是 Lease 在持有者之间转换的次数。

  • preferredHolder (string)

    PreferredHolder 向 Lease 持有者发出信号,该 Lease 有一个更优化的持有者,应该放弃。只有在设置 Strategy 时才能设置此字段。

  • renewTime (MicroTime)

    renewTime 是当前 Lease 持有者上次更新 Lease 的时间。

    MicroTime 是具有微秒级精度的 Time 版本。

  • strategy (string)

    Strategy 指示协调领导者选举中选择领导者的策略。如果未指定该字段,则此 Lease 没有活动的协调。 (Alpha) 使用此字段需要启用 CoordinatedLeaderElection 特性门控。

LeaseList

LeaseList 是 Lease 对象的列表。


操作


get 读取指定的 Lease

HTTP 请求

GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}

Parameters

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

    Lease 的名称

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

    命名空间

  • pretty (在查询中): string

    pretty

响应

200 (Lease): OK

401: 未授权

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

HTTP 请求

GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases

Parameters

响应

200 (LeaseList): OK

401: 未授权

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

HTTP 请求

GET /apis/coordination.k8s.io/v1/leases

Parameters

响应

200 (LeaseList): OK

401: 未授权

create 创建一个 Lease

HTTP 请求

POST /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases

Parameters

响应

200 (Lease): OK

201 (Lease): Created

202 (Lease): Accepted

401: 未授权

update 替换指定的 Lease

HTTP 请求

PUT /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}

Parameters

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

    Lease 的名称

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

    命名空间

  • body: Lease, required

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • pretty (在查询中): string

    pretty

响应

200 (Lease): OK

201 (Lease): Created

401: 未授权

patch 部分更新指定的 Lease

HTTP 请求

PATCH /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}

Parameters

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

    Lease 的名称

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

    命名空间

  • body: Patch, 必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (in query): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (Lease): OK

201 (Lease): Created

401: 未授权

delete 删除一个 Lease

HTTP 请求

DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}

Parameters

响应

200 (Status): 确定

202 (Status): 已接受

401: 未授权

deletecollection 删除 Lease 集合

HTTP 请求

DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases

Parameters

响应

200 (Status): 确定

401: 未授权

本页面是自动生成的。

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

上次修改时间:2025 年 4 月 9 日下午 6:36 PST:更新 v1.32 的 API 参考文档 (a3b579d035)