租约
apiVersion: coordination.k8s.io/v1
import "k8s.io/api/coordination/v1"
租约
Lease 定义了一个租约概念。
apiVersion: coordination.k8s.io/v1
kind: Lease
metadata (ObjectMeta)
更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
spec (LeaseSpec)
spec 包含 Lease 的规约。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
LeaseSpec
LeaseSpec 是 Lease 的规约。
acquireTime (MicroTime)
acquireTime 是获得当前租约的时间。
holderIdentity (string)
holderIdentity 包含当前租约持有者的身份。如果使用协调式领导者选举,持有者的身份必须等于选定的 LeaseCandidate.metadata.name 字段。
leaseDurationSeconds (int32)
leaseDurationSeconds 是租约候选者需要等待以强制获取租约的持续时间。这是根据最后观察到的 renewTime 来衡量的。
leaseTransitions (int32)
leaseTransitions 是租约在不同持有者之间转换的次数。
preferredHolder (string)
PreferredHolder 向租约持有者发出信号,表明存在一个更优化的持有者,应放弃当前租约。仅当 Strategy 字段也被设置时,此字段才能设置。
renewTime (MicroTime)
renewTime 是当前租约持有者最后一次更新租约的时间。
strategy (string)
Strategy 指示协调式领导者选举中选择领导者的策略。如果未指定此字段,则表示该租约没有主动的协调。(Alpha)使用此字段需要启用 CoordinatedLeaderElection 功能门控。
LeaseList
LeaseList 是 Lease 对象的列表。
apiVersion: coordination.k8s.io/v1
kind: LeaseList
metadata (ListMeta)
标准列表元数据。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
items ([]Lease),必选
items 是模式对象的列表。
操作
get
读取指定的 Lease
HTTP 请求
GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
响应
200 (Lease):OK
401:未授权
list
列出或监听类型为 Lease 的对象
HTTP 请求
GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases
参数
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 (LeaseList):OK
401:未授权
list
列出或监听类型为 Lease 的对象
HTTP 请求
GET /apis/coordination.k8s.io/v1/leases
参数
allowWatchBookmarks (在查询参数中):boolean
continue (在查询参数中):string
fieldSelector (在查询参数中):string
labelSelector (在查询参数中):string
limit (在查询参数中):integer
pretty (在查询参数中):string
resourceVersion (在查询参数中):string
resourceVersionMatch (在查询参数中):string
sendInitialEvents (在查询参数中):boolean
timeoutSeconds (在查询参数中):integer
watch (在查询参数中):boolean
响应
200 (LeaseList):OK
401:未授权
create
创建一个 Lease
HTTP 请求
POST /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases
参数
namespace (在路径中):string,必选
body:Lease,必选
dryRun (在查询参数中):string
fieldManager (在查询参数中):string
fieldValidation (在查询参数中):string
pretty (在查询参数中):string
响应
200 (Lease):OK
201 (Lease):已创建
202 (Lease):已接受
401:未授权
update
替换指定的 Lease
HTTP 请求
PUT /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
name (在路径中):string,必选
Lease 的名称
namespace (在路径中):string,必选
body:Lease,必选
dryRun (在查询参数中):string
fieldManager (在查询参数中):string
fieldValidation (在查询参数中):string
pretty (在查询参数中):string
响应
200 (Lease):OK
201 (Lease):已创建
401:未授权
patch
部分更新指定的 Lease
HTTP 请求
PATCH /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
name (在路径中):string,必选
Lease 的名称
namespace (在路径中):string,必选
body:Patch,必选
dryRun (在查询参数中):string
fieldManager (在查询参数中):string
fieldValidation (在查询参数中):string
force (在查询参数中):boolean
pretty (在查询参数中):string
响应
200 (Lease):OK
201 (Lease):已创建
401:未授权
delete
删除一个 Lease
HTTP 请求
DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
name (在路径中):string,必选
Lease 的名称
namespace (在路径中):string,必选
body:DeleteOptions
dryRun (在查询参数中):string
gracePeriodSeconds (在查询参数中):integer
ignoreStoreReadErrorWithClusterBreakingPotential (在查询参数中):boolean
pretty (在查询参数中):string
propagationPolicy (在查询参数中):string
响应
200 (Status):OK
202 (Status):已接受
401:未授权
deletecollection
删除 Lease 集合
HTTP 请求
DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases
参数
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 项目的其他地方进行。