Skip to main content

StatefulSet [apps/v1]

Description
StatefulSet represents a set of pods with consistent identities. Identities are defined as:
  • Network: A single stable DNS and hostname.
  • Storage: As many VolumeClaims as requested.
The StatefulSet guarantees that a given network identity will always map to the same storage identity.
Type
`object`

Specification​

PropertyTypeDescription
apiVersionstringAPIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kindstringKind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadataObjectMetaStandard object’s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
specobjectA StatefulSetSpec is the specification of a StatefulSet.
statusobjectStatefulSetStatus represents the current state of a StatefulSet.

.spec​

Description
A StatefulSetSpec is the specification of a StatefulSet.
Type
`object`
Required
  • selector
  • template
PropertyTypeDescription
minReadySecondsintegerMinimum number of seconds for which a newly created pod should be ready without any of its container crashing for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)
ordinalsobjectStatefulSetOrdinals describes the policy used for replica ordinal assignment in this StatefulSet.
persistentVolumeClaimRetentionPolicyobjectStatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates.
podManagementPolicystringpodManagementPolicy controls how pods are created during initial scale up, when replacing pods on nodes, or when scaling down. The default policy is OrderedReady, where pods are created in increasing order (pod-0, then pod-1, etc) and the controller will wait until each pod is ready before continuing. When scaling down, the pods are removed in the opposite order. The alternative policy is Parallel which will create pods in parallel to match the desired scale without waiting, and on scale down will delete all pods at once.
Possible enum values: - "OrderedReady" will create pods in strictly increasing order on scale up and strictly decreasing order on scale down, progressing only when the previous pod is ready or terminated. At most one pod will be changed at any time. - "Parallel" will create and delete pods as soon as the stateful set replica count is changed, and will not wait for pods to be ready or complete termination.
replicasintegerreplicas is the desired number of replicas of the given Template. These are replicas in the sense that they are instantiations of the same Template, but individual replicas also have a consistent identity. If unspecified, defaults to 1.
revisionHistoryLimitintegerrevisionHistoryLimit is the maximum number of revisions that will be maintained in the StatefulSet’s revision history. The revision history consists of all revisions not represented by a currently applied StatefulSetSpec version. The default value is 10.
selectorLabelSelectorselector is a label query over pods that should match the replica count. It must match the pod template’s labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
serviceNamestringserviceName is the name of the service that governs this StatefulSet. This service must exist before the StatefulSet, and is responsible for the network identity of the set. Pods get DNS/hostnames that follow the pattern: pod-specific-string.serviceName.default.svc.cluster.local where "pod-specific-string" is managed by the StatefulSet controller.
templatePodTemplateSpectemplate is the object that describes the pod that will be created if insufficient replicas are detected. Each pod stamped out by the StatefulSet will fulfill this Template, but have a unique identity from the rest of the StatefulSet. Each pod will be named with the format -. For example, a pod in a StatefulSet named "web" with index number "3" would be named "web-3". The only allowed template.spec.restartPolicy value is "Always".
updateStrategyobjectStatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy.
volumeClaimTemplatesarray (PersistentVolumeClaim)volumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. A claim in this list takes precedence over any volumes in the template, with the same name.

.spec.ordinals​

Description
StatefulSetOrdinals describes the policy used for replica ordinal assignment in this StatefulSet.
Type
`object`
PropertyTypeDescription
startintegerstart is the number representing the first replica’s index. It may be used to number replicas from an alternate index (eg: 1-indexed) over the default 0-indexed names, or to orchestrate progressive movement of replicas from one StatefulSet to another. If set, replica indices will be in the range: [.spec.ordinals.start, .spec.ordinals.start + .spec.replicas). If unset, defaults to 0. Replica indices will be in the range: [0, .spec.replicas).

.spec.persistentVolumeClaimRetentionPolicy​

Description
StatefulSetPersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates.
Type
`object`
PropertyTypeDescription
whenDeletedstringWhenDeleted specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is deleted. The default policy of Retain causes PVCs to not be affected by StatefulSet deletion. The Delete policy causes those PVCs to be deleted.
whenScaledstringWhenScaled specifies what happens to PVCs created from StatefulSet VolumeClaimTemplates when the StatefulSet is scaled down. The default policy of Retain causes PVCs to not be affected by a scaledown. The Delete policy causes the associated PVCs for any excess pods above the replica count to be deleted.

.spec.updateStrategy​

Description
StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy.
Type
`object`
PropertyTypeDescription
rollingUpdateobjectRollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.
typestringType indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate.
Possible enum values: - "OnDelete" triggers the legacy behavior. Version tracking and ordered rolling restarts are disabled. Pods are recreated from the StatefulSetSpec when they are manually deleted. When a scale operation is performed with this strategy,specification version indicated by the StatefulSet’s currentRevision. - "RollingUpdate" indicates that update will be applied to all Pods in the StatefulSet with respect to the StatefulSet ordering constraints. When a scale operation is performed with this strategy, new Pods will be created from the specification version indicated by the StatefulSet’s updateRevision.

.spec.updateStrategy.rollingUpdate​

Description
RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType.
Type
`object`
PropertyTypeDescription
maxUnavailableIntOrStringThe maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding up. This can not be 0. Defaults to 1. This field is beta-level and is enabled by default. The field applies to all pods in the range 0 to Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it will be counted towards MaxUnavailable. This setting might not be effective for the OrderedReady podManagementPolicy. That policy ensures pods are created and become ready one at a time.
partitionintegerPartition indicates the ordinal at which the StatefulSet should be partitioned for updates. During a rolling update, all pods from ordinal Replicas-1 to Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. This is helpful in being able to do a canary based deployment. The default value is 0.

.status​

Description
StatefulSetStatus represents the current state of a StatefulSet.
Type
`object`
Required
  • replicas
PropertyTypeDescription
availableReplicasintegerTotal number of available pods (ready for at least minReadySeconds) targeted by this statefulset.
collisionCountintegercollisionCount is the count of hash collisions for the StatefulSet. The StatefulSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.
conditionsarrayRepresents the latest available observations of a statefulset’s current state.
conditions[]objectStatefulSetCondition describes the state of a statefulset at a certain point.
currentReplicasintegercurrentReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by currentRevision.
currentRevisionstringcurrentRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [0,currentReplicas).
observedGenerationintegerobservedGeneration is the most recent generation observed for this StatefulSet. It corresponds to the StatefulSet’s generation, which is updated on mutation by the API Server.
readyReplicasintegerreadyReplicas is the number of pods created for this StatefulSet with a Ready Condition.
replicasintegerreplicas is the number of Pods created by the StatefulSet controller.
updateRevisionstringupdateRevision, if not empty, indicates the version of the StatefulSet used to generate Pods in the sequence [replicas-updatedReplicas,replicas)
updatedReplicasintegerupdatedReplicas is the number of Pods created by the StatefulSet controller from the StatefulSet version indicated by updateRevision.

.status.conditions​

Description
Represents the latest available observations of a statefulset’s current state.
Type
`array`

.status.conditions[]​

Description
StatefulSetCondition describes the state of a statefulset at a certain point.
Type
`object`
Required
  • type
  • status
PropertyTypeDescription
lastTransitionTimeTimeLast time the condition transitioned from one status to another.
messagestringA human readable message indicating details about the transition.
reasonstringThe reason for the condition’s last transition.
statusstringStatus of the condition, one of True, False, Unknown.
typestringType of statefulset condition.

API endpoints​

The following API endpoints are available:

  • /apis/apps/v1/statefulsets
    • GET: list or watch objects of kind StatefulSet
  • /apis/apps/v1/watch/statefulsets
    • GET: watch individual changes to a list of StatefulSet. deprecated: use the 'watch' parameter with a list operation instead.
  • /apis/apps/v1/namespaces/{namespace}/statefulsets
    • DELETE: delete collection of StatefulSet
    • GET: list or watch objects of kind StatefulSet
    • POST: create a StatefulSet
  • /apis/apps/v1/watch/namespaces/{namespace}/statefulsets
    • GET: watch individual changes to a list of StatefulSet. deprecated: use the 'watch' parameter with a list operation instead.
  • /apis/apps/v1/namespaces/{namespace}/statefulsets/{name}
    • DELETE: delete a StatefulSet
    • GET: read the specified StatefulSet
    • PATCH: partially update the specified StatefulSet
    • PUT: replace the specified StatefulSet
  • /apis/apps/v1/watch/namespaces/{namespace}/statefulsets/{name}
    • GET: watch changes to an object of kind StatefulSet. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.
  • /apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status
    • GET: read status of the specified StatefulSet
    • PATCH: partially update status of the specified StatefulSet
    • PUT: replace status of the specified StatefulSet

/apis/apps/v1/statefulsets​

HTTP method
`GET`
Description
list or watch objects of kind StatefulSet

HTTP responses

HTTP codeReponse body
200 - OKStatefulSetList schema
401 - UnauthorizedEmpty

/apis/apps/v1/watch/statefulsets​

HTTP method
`GET`
Description
watch individual changes to a list of StatefulSet. deprecated: use the 'watch' parameter with a list operation instead.

HTTP responses

HTTP codeReponse body
200 - OKWatchEvent schema
401 - UnauthorizedEmpty

/apis/apps/v1/namespaces/{namespace}/statefulsets​

HTTP method
`DELETE`
Description
delete collection of StatefulSet

Query parameters

ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

HTTP responses

HTTP codeReponse body
200 - OKStatus schema
401 - UnauthorizedEmpty
HTTP method
`GET`
Description
list or watch objects of kind StatefulSet

HTTP responses

HTTP codeReponse body
200 - OKStatefulSetList schema
401 - UnauthorizedEmpty
HTTP method
`POST`
Description
create a StatefulSet

Query parameters

ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.

Body parameters

ParameterTypeDescription
bodyStatefulSet schema

HTTP responses

HTTP codeReponse body
200 - OKStatefulSet schema
201 - CreatedStatefulSet schema
202 - AcceptedStatefulSet schema
401 - UnauthorizedEmpty

/apis/apps/v1/watch/namespaces/{namespace}/statefulsets​

HTTP method
`GET`
Description
watch individual changes to a list of StatefulSet. deprecated: use the 'watch' parameter with a list operation instead.

HTTP responses

HTTP codeReponse body
200 - OKWatchEvent schema
401 - UnauthorizedEmpty

/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}​

Global path parameters

ParameterTypeDescription
namestringname of the StatefulSet
HTTP method
`DELETE`
Description
delete a StatefulSet

Query parameters

ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

HTTP responses

HTTP codeReponse body
200 - OKStatus schema
202 - AcceptedStatus schema
401 - UnauthorizedEmpty
HTTP method
`GET`
Description
read the specified StatefulSet

HTTP responses

HTTP codeReponse body
200 - OKStatefulSet schema
401 - UnauthorizedEmpty
HTTP method
`PATCH`
Description
partially update the specified StatefulSet

Query parameters

ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.

HTTP responses

HTTP codeReponse body
200 - OKStatefulSet schema
201 - CreatedStatefulSet schema
401 - UnauthorizedEmpty
HTTP method
`PUT`
Description
replace the specified StatefulSet

Query parameters

ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.

Body parameters

ParameterTypeDescription
bodyStatefulSet schema

HTTP responses

HTTP codeReponse body
200 - OKStatefulSet schema
201 - CreatedStatefulSet schema
401 - UnauthorizedEmpty

/apis/apps/v1/watch/namespaces/{namespace}/statefulsets/{name}​

Global path parameters

ParameterTypeDescription
namestringname of the StatefulSet
HTTP method
`GET`
Description
watch changes to an object of kind StatefulSet. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.

HTTP responses

HTTP codeReponse body
200 - OKWatchEvent schema
401 - UnauthorizedEmpty

/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status​

Global path parameters

ParameterTypeDescription
namestringname of the StatefulSet
HTTP method
`GET`
Description
read status of the specified StatefulSet

HTTP responses

HTTP codeReponse body
200 - OKStatefulSet schema
401 - UnauthorizedEmpty
HTTP method
`PATCH`
Description
partially update status of the specified StatefulSet

Query parameters

ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.

HTTP responses

HTTP codeReponse body
200 - OKStatefulSet schema
201 - CreatedStatefulSet schema
401 - UnauthorizedEmpty
HTTP method
`PUT`
Description
replace status of the specified StatefulSet

Query parameters

ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.

Body parameters

ParameterTypeDescription
bodyStatefulSet schema

HTTP responses

HTTP codeReponse body
200 - OKStatefulSet schema
201 - CreatedStatefulSet schema
401 - UnauthorizedEmpty