26 KiB
| api_metadata | content_type | description | title | weight | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
api_reference | Lease 定义了租约的概念。 | Lease | 5 |
apiVersion: coordination.k8s.io/v1
import "k8s.io/api/coordination/v1"
Lease
Lease 定义了租约的概念。
-
apiVersion: coordination.k8s.io/v1
-
kind: Lease
-
metadata (<a href="{{< ref "../common-definitions/object-meta#ObjectMeta" >}}">ObjectMeta)
更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
spec (<a href="{{< ref "../cluster-resources/lease-v1#LeaseSpec" >}}">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 包含当前租约持有人的身份。 如果使用协调领导者选举(Coordinated Leader Election), 则持有人身份必须等于选举出的 LeaseCandidate.metadata.name 字段。
-
leaseDurationSeconds (int32)
leaseDurationSeconds 是租约候选人需要等待强制获取租约的持续时间。 这是相对于上次观察到的 renewTime 的度量。
-
leaseTransitions (int32)
leaseTransitions 是租约持有人之间的转换次数。
-
preferredHolder (string)
preferredHolder 向租约持有人发出信号,提示此租约出现一个更优的持有人且应该被放弃。 此字段仅在设置了
strategy时才能被设置。
-
renewTime (MicroTime)
renewTime 是当前租约持有人上次更新租约的时间。
-
strategy(字符串)
strategy 指示为协调领导者选举选择领导者的策略。 如果此字段未被指定,则此租约没有主动的协调。 (Alpha)使用此字段需要启用 CoordinatedLeaderElection 特性门控。
LeaseList
LeaseList 是 Lease 对象的列表。
-
apiVersion: coordination.k8s.io/v1
-
kind: LeaseList
-
metadata (<a href="{{< ref "../common-definitions/list-meta#ListMeta" >}}">ListMeta)
标准的列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
-
items ([]<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease),必需
items 是架构对象的列表。
操作
get 读取指定的 Lease
HTTP 请求
GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
-
name (路径参数): string,必需
Lease 的名称。
-
namespace (路径参数): string,必需
<a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
响应
200 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): OK
401: Unauthorized
list 列出或监视类别为 Lease 的对象
HTTP 请求
GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases
参数
-
namespace (路径参数): string,必需
<a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace
-
allowWatchBookmarks (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks
-
continue (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue
-
fieldSelector (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector
-
labelSelector (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector
-
limit (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
-
resourceVersion (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion
-
resourceVersionMatch (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch
-
sendInitialEvents (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents
-
timeoutSeconds (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds
-
watch (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch
响应
200 (<a href="{{< ref "../cluster-resources/lease-v1#LeaseList" >}}">LeaseList): OK
401: Unauthorized
list 列出或监视类别为 Lease 的对象
HTTP 请求
GET /apis/coordination.k8s.io/v1/leases
参数
-
allowWatchBookmarks (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks
-
continue (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue
-
fieldSelector (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector
-
labelSelector (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector
-
limit (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
-
resourceVersion (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion
-
resourceVersionMatch (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch
-
sendInitialEvents (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents
-
timeoutSeconds (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds
-
watch (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch
响应
200 (<a href="{{< ref "../cluster-resources/lease-v1#LeaseList" >}}">LeaseList): OK
401: Unauthorized
create 创建 Lease
HTTP 请求
POST /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases
参数
-
namespace (路径参数): string,必需
<a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace
-
body: <a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease,必需
-
dryRun (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun
-
fieldManager (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager
-
fieldValidation (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
响应
200 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): OK
201 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): Created
202 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): Accepted
401: Unauthorized
update 替换指定的 Lease
HTTP 请求
PUT /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
-
name (路径参数): string,必需
Lease 的名称。
-
namespace (路径参数): string,必需
<a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace
-
body: <a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease,必需
-
dryRun (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun
-
fieldManager (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager
-
fieldValidation (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
响应
200 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): OK
201 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): Created
401: Unauthorized
patch 部分更新指定的 Lease
HTTP 请求
PATCH /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
-
name (路径参数): string,必需
Lease 的名称。
-
namespace (路径参数): string,必需
<a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace
-
body: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch,必需
-
dryRun (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun
-
fieldManager (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager
-
fieldValidation (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation
-
force (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#force" >}}">force
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
响应
200 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): OK
201 (<a href="{{< ref "../cluster-resources/lease-v1#Lease" >}}">Lease): Created
401: Unauthorized
delete 删除 Lease
HTTP 请求
DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name}
参数
-
name (路径参数): string,必需
Lease 的名称。
-
namespace (路径参数): string,必需
<a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace
-
body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions
-
dryRun (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun
-
gracePeriodSeconds (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
-
propagationPolicy (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy
响应
200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK
202 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): Accepted
401: Unauthorized
deletecollection 删除 Lease 收款
HTTP 请求
DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases
参数
-
namespace (路径参数): string,必需
<a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace
-
body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions
-
continue (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue
-
dryRun (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun
-
fieldSelector (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector
-
gracePeriodSeconds (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds
-
labelSelector (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector
-
limit (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit
-
pretty (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty
-
propagationPolicy (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy
-
resourceVersion (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion
-
resourceVersionMatch (查询参数): string
<a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch
-
sendInitialEvents (查询参数): boolean
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents
-
timeoutSeconds (查询参数): integer
<a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds
响应
200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK
401: Unauthorized