--- api_metadata: apiVersion: "coordination.k8s.io/v1" import: "k8s.io/api/coordination/v1" kind: "Lease" content_type: "api_reference" description: "Lease defines a lease concept." title: "Lease" weight: 5 auto_generated: true --- `apiVersion: coordination.k8s.io/v1` `import "k8s.io/api/coordination/v1"` ## Lease {#Lease} Lease defines a lease concept.
- **apiVersion**: coordination.k8s.io/v1 - **kind**: Lease - **metadata** (}}">ObjectMeta) More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - **spec** (}}">LeaseSpec) spec contains the specification of the Lease. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status ## LeaseSpec {#LeaseSpec} LeaseSpec is a specification of a Lease.
- **acquireTime** (MicroTime) acquireTime is a time when the current lease was acquired. *MicroTime is version of Time with microsecond level precision.* - **holderIdentity** (string) holderIdentity contains the identity of the holder of a current lease. If Coordinated Leader Election is used, the holder identity must be equal to the elected LeaseCandidate.metadata.name field. - **leaseDurationSeconds** (int32) leaseDurationSeconds is a duration that candidates for a lease need to wait to force acquire it. This is measured against the time of last observed renewTime. - **leaseTransitions** (int32) leaseTransitions is the number of transitions of a lease between holders. - **preferredHolder** (string) PreferredHolder signals to a lease holder that the lease has a more optimal holder and should be given up. This field can only be set if Strategy is also set. - **renewTime** (MicroTime) renewTime is a time when the current holder of a lease has last updated the lease. *MicroTime is version of Time with microsecond level precision.* - **strategy** (string) Strategy indicates the strategy for picking the leader for coordinated leader election. If the field is not specified, there is no active coordination for this lease. (Alpha) Using this field requires the CoordinatedLeaderElection feature gate to be enabled. ## LeaseList {#LeaseList} LeaseList is a list of Lease objects.
- **apiVersion**: coordination.k8s.io/v1 - **kind**: LeaseList - **metadata** (}}">ListMeta) Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - **items** ([]}}">Lease), required items is a list of schema objects. ## Operations {#Operations}
### `get` read the specified Lease #### HTTP Request GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name} #### Parameters - **name** (*in path*): string, required name of the Lease - **namespace** (*in path*): string, required }}">namespace - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">Lease): OK 401: Unauthorized ### `list` list or watch objects of kind Lease #### HTTP Request GET /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases #### Parameters - **namespace** (*in path*): string, required }}">namespace - **allowWatchBookmarks** (*in query*): boolean }}">allowWatchBookmarks - **continue** (*in query*): string }}">continue - **fieldSelector** (*in query*): string }}">fieldSelector - **labelSelector** (*in query*): string }}">labelSelector - **limit** (*in query*): integer }}">limit - **pretty** (*in query*): string }}">pretty - **resourceVersion** (*in query*): string }}">resourceVersion - **resourceVersionMatch** (*in query*): string }}">resourceVersionMatch - **sendInitialEvents** (*in query*): boolean }}">sendInitialEvents - **timeoutSeconds** (*in query*): integer }}">timeoutSeconds - **watch** (*in query*): boolean }}">watch #### Response 200 (}}">LeaseList): OK 401: Unauthorized ### `list` list or watch objects of kind Lease #### HTTP Request GET /apis/coordination.k8s.io/v1/leases #### Parameters - **allowWatchBookmarks** (*in query*): boolean }}">allowWatchBookmarks - **continue** (*in query*): string }}">continue - **fieldSelector** (*in query*): string }}">fieldSelector - **labelSelector** (*in query*): string }}">labelSelector - **limit** (*in query*): integer }}">limit - **pretty** (*in query*): string }}">pretty - **resourceVersion** (*in query*): string }}">resourceVersion - **resourceVersionMatch** (*in query*): string }}">resourceVersionMatch - **sendInitialEvents** (*in query*): boolean }}">sendInitialEvents - **timeoutSeconds** (*in query*): integer }}">timeoutSeconds - **watch** (*in query*): boolean }}">watch #### Response 200 (}}">LeaseList): OK 401: Unauthorized ### `create` create a Lease #### HTTP Request POST /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases #### Parameters - **namespace** (*in path*): string, required }}">namespace - **body**: }}">Lease, required - **dryRun** (*in query*): string }}">dryRun - **fieldManager** (*in query*): string }}">fieldManager - **fieldValidation** (*in query*): string }}">fieldValidation - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">Lease): OK 201 (}}">Lease): Created 202 (}}">Lease): Accepted 401: Unauthorized ### `update` replace the specified Lease #### HTTP Request PUT /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name} #### Parameters - **name** (*in path*): string, required name of the Lease - **namespace** (*in path*): string, required }}">namespace - **body**: }}">Lease, required - **dryRun** (*in query*): string }}">dryRun - **fieldManager** (*in query*): string }}">fieldManager - **fieldValidation** (*in query*): string }}">fieldValidation - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">Lease): OK 201 (}}">Lease): Created 401: Unauthorized ### `patch` partially update the specified Lease #### HTTP Request PATCH /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name} #### Parameters - **name** (*in path*): string, required name of the Lease - **namespace** (*in path*): string, required }}">namespace - **body**: }}">Patch, required - **dryRun** (*in query*): string }}">dryRun - **fieldManager** (*in query*): string }}">fieldManager - **fieldValidation** (*in query*): string }}">fieldValidation - **force** (*in query*): boolean }}">force - **pretty** (*in query*): string }}">pretty #### Response 200 (}}">Lease): OK 201 (}}">Lease): Created 401: Unauthorized ### `delete` delete a Lease #### HTTP Request DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases/{name} #### Parameters - **name** (*in path*): string, required name of the Lease - **namespace** (*in path*): string, required }}">namespace - **body**: }}">DeleteOptions - **dryRun** (*in query*): string }}">dryRun - **gracePeriodSeconds** (*in query*): integer }}">gracePeriodSeconds - **pretty** (*in query*): string }}">pretty - **propagationPolicy** (*in query*): string }}">propagationPolicy #### Response 200 (}}">Status): OK 202 (}}">Status): Accepted 401: Unauthorized ### `deletecollection` delete collection of Lease #### HTTP Request DELETE /apis/coordination.k8s.io/v1/namespaces/{namespace}/leases #### Parameters - **namespace** (*in path*): string, required }}">namespace - **body**: }}">DeleteOptions - **continue** (*in query*): string }}">continue - **dryRun** (*in query*): string }}">dryRun - **fieldSelector** (*in query*): string }}">fieldSelector - **gracePeriodSeconds** (*in query*): integer }}">gracePeriodSeconds - **labelSelector** (*in query*): string }}">labelSelector - **limit** (*in query*): integer }}">limit - **pretty** (*in query*): string }}">pretty - **propagationPolicy** (*in query*): string }}">propagationPolicy - **resourceVersion** (*in query*): string }}">resourceVersion - **resourceVersionMatch** (*in query*): string }}">resourceVersionMatch - **sendInitialEvents** (*in query*): boolean }}">sendInitialEvents - **timeoutSeconds** (*in query*): integer }}">timeoutSeconds #### Response 200 (}}">Status): OK 401: Unauthorized