租約

租約定義了租約概念。

apiVersion: coordination.k8s.io/v1

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

租約

租約定義了租約概念。


LeaseSpec

LeaseSpec 是租約的規範。


  • acquireTime (MicroTime)

    acquireTime 是目前租約被取得的時間。

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

  • holderIdentity (字串)

    holderIdentity 包含目前租約持有者的身份。如果使用協調領導者選舉,則持有者身份必須等於選出的 LeaseCandidate.metadata.name 欄位。

  • leaseDurationSeconds (int32)

    leaseDurationSeconds 是租約候選者需要等待以強制取得租約的持續時間。這是根據上次觀察到的 renewTime 時間來衡量的。

  • leaseTransitions (int32)

    leaseTransitions 是租約在持有者之間轉換的次數。

  • preferredHolder (字串)

    PreferredHolder 向租約持有者發出訊號,表示租約有更佳的持有者,應放棄。只有在也設定 Strategy 時,才能設定此欄位。

  • renewTime (MicroTime)

    renewTime 是租約的目前持有者上次更新租約的時間。

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

  • strategy (字串)

    Strategy 指出用於為協調領導者選舉挑選領導者的策略。如果未指定此欄位,則此租約沒有作用中的協調。(Alpha)使用此欄位需要啟用 CoordinatedLeaderElection 功能閘道。

LeaseList

LeaseList 是租約物件的列表。


操作


get 讀取指定的租約

HTTP 請求

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

參數

  • name (在路徑中): 字串,必要

    租約的名稱

  • namespace (在路徑中): 字串,必要

    命名空間

  • pretty (在查詢中): 字串

    pretty

回應

200 (Lease): 成功

401: 未經授權

list 列出或監看租約類型的物件

HTTP 請求

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

參數

回應

200 (LeaseList): 成功

401: 未經授權

list 列出或監看租約類型的物件

HTTP 請求

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

參數

回應

200 (LeaseList): 成功

401: 未經授權

create 建立租約

HTTP 請求

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

參數

回應

200 (Lease): 成功

201 (Lease): 已建立

202 (Lease): 已接受

401: 未經授權

update 取代指定的租約

HTTP 請求

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

參數

  • name (在路徑中): 字串,必要

    租約的名稱

  • namespace (在路徑中): 字串,必要

    命名空間

  • body: Lease,必要

  • dryRun (在查詢中): 字串

    dryRun

  • fieldManager (在查詢中): 字串

    fieldManager

  • fieldValidation (在查詢中): 字串

    fieldValidation

  • pretty (在查詢中): 字串

    pretty

回應

200 (Lease): 成功

201 (Lease): 已建立

401: 未經授權

patch 部分更新指定的租約

HTTP 請求

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

參數

  • name (在路徑中): 字串,必要

    租約的名稱

  • namespace (在路徑中): 字串,必要

    命名空間

  • body: Patch,必要

  • dryRun (在查詢中): 字串

    dryRun

  • fieldManager (在查詢中): 字串

    fieldManager

  • fieldValidation (在查詢中): 字串

    fieldValidation

  • force (在查詢中): 布林值

    force

  • pretty (在查詢中): 字串

    pretty

回應

200 (Lease): 成功

201 (Lease): 已建立

401: 未經授權

delete 刪除租約

HTTP 請求

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

參數

回應

200 (Status): 成功

202 (Status): 已接受

401: 未經授權

deletecollection 刪除 Lease 集合

HTTP 請求

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

參數

回應

200 (Status): 成功

401: 未經授權

此頁面為自動產生。

如果您計劃回報此頁面的問題,請在您的問題描述中提及此頁面為自動產生。此問題的修正可能需要在 Kubernetes 專案的其他地方進行。

上次修改時間為 2024 年 8 月 28 日下午 6:01 PST:更新 v1.31 的自動產生 API 參考文件 (8ba98c79c1)