Class StatefulSet
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- software.constructs.Construct
-
- org.cdk8s.plus23.Resource
-
- org.cdk8s.plus23.AbstractPod
-
- org.cdk8s.plus23.Workload
-
- org.cdk8s.plus23.StatefulSet
-
- All Implemented Interfaces:
IApiEndpoint,IApiResource,INetworkPolicyPeer,IPodSelector,IResource,ISubject,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.61.0 (build abf4039)", date="2022-07-06T20:17:23.709Z") @Stability(Stable) public class StatefulSet extends Workload
StatefulSet is the workload API object used to manage stateful applications.Manages the deployment and scaling of a set of Pods, and provides guarantees about the ordering and uniqueness of these Pods.
Like a Deployment, a StatefulSet manages Pods that are based on an identical container spec. Unlike a Deployment, a StatefulSet maintains a sticky identity for each of their Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.
If you want to use storage volumes to provide persistence for your workload, you can use a StatefulSet as part of the solution. Although individual Pods in a StatefulSet are susceptible to failure, the persistent Pod identifiers make it easier to match existing volumes to the new Pods that replace any that have failed.
Using StatefulSets
StatefulSets are valuable for applications that require one or more of the following.
- Stable, unique network identifiers.
- Stable, persistent storage.
- Ordered, graceful deployment and scaling.
- Ordered, automated rolling updates.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStatefulSet.BuilderA fluent builder forStatefulSet.-
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Nested classes/interfaces inherited from interface org.cdk8s.plus23.IApiEndpoint
IApiEndpoint.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus23.IApiResource
IApiResource.Jsii$Default
-
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus23.INetworkPolicyPeer
INetworkPolicyPeer.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus23.IPodSelector
IPodSelector.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus23.IResource
IResource.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus23.ISubject
ISubject.Jsii$Default
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStatefulSet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)protectedStatefulSet(software.amazon.jsii.JsiiObjectRef objRef)StatefulSet(software.constructs.Construct scope, String id, StatefulSetProps props)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.cdk8s.ApiObjectgetApiObject()The underlying cdk8s API object.org.cdk8s.DurationgetMinReady()Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.PodManagementPolicygetPodManagementPolicy()Management policy to use for the set.NumbergetReplicas()Number of desired pods.StringgetResourceType()The name of a resource type as it appears in the relevant API endpoint.StatefulSetUpdateStrategygetStrategy()The update startegy of this stateful set.-
Methods inherited from class org.cdk8s.plus23.Workload
getConnections, getMatchExpressions, getMatchLabels, getPodMetadata, getScheduling, select
-
Methods inherited from class org.cdk8s.plus23.AbstractPod
addContainer, addHostAlias, addInitContainer, addVolume, getAutomountServiceAccountToken, getContainers, getDns, getDockerRegistryAuth, getHostAliases, getInitContainers, getRestartPolicy, getSecurityContext, getServiceAccount, getVolumes, toNetworkPolicyPeerConfig, toPodSelector, toPodSelectorConfig, toSubjectConfiguration
-
Methods inherited from class org.cdk8s.plus23.Resource
asApiResource, asNonApiResource, getApiGroup, getApiVersion, getKind, getMetadata, getName, getPermissions, getResourceName
-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Constructor Detail
-
StatefulSet
protected StatefulSet(software.amazon.jsii.JsiiObjectRef objRef)
-
StatefulSet
protected StatefulSet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
StatefulSet
@Stability(Stable) public StatefulSet(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull StatefulSetProps props)- Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Detail
-
getApiObject
@Stability(Stable) @NotNull protected org.cdk8s.ApiObject getApiObject()
The underlying cdk8s API object.- Specified by:
getApiObjectin classResource- See Also:
- base.Resource.apiObject
-
getMinReady
@Stability(Stable) @NotNull public org.cdk8s.Duration getMinReady()
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
-
getPodManagementPolicy
@Stability(Stable) @NotNull public PodManagementPolicy getPodManagementPolicy()
Management policy to use for the set.
-
getReplicas
@Stability(Stable) @NotNull public Number getReplicas()
Number of desired pods.
-
getResourceType
@Stability(Stable) @NotNull public String getResourceType()
The name of a resource type as it appears in the relevant API endpoint.- Specified by:
getResourceTypein interfaceIApiResource- Specified by:
getResourceTypein classResource- See Also:
- https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
-
getStrategy
@Stability(Stable) @NotNull public StatefulSetUpdateStrategy getStrategy()
The update startegy of this stateful set.
-
-