Class StatefulSet
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- software.constructs.Construct
-
- org.cdk8s.plus24.Resource
-
- org.cdk8s.plus24.AbstractPod
-
- org.cdk8s.plus24.Workload
-
- org.cdk8s.plus24.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.65.0 (build 7a02b7f)", date="2022-08-21T02:57:21.503Z") @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 class
StatefulSet.Builder
A 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.plus24.IApiEndpoint
IApiEndpoint.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.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.plus24.INetworkPolicyPeer
INetworkPolicyPeer.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.IPodSelector
IPodSelector.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.IResource
IResource.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.ISubject
ISubject.Jsii$Default
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
StatefulSet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected
StatefulSet(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.ApiObject
getApiObject()
The underlying cdk8s API object.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.PodManagementPolicy
getPodManagementPolicy()
Management policy to use for the set.Number
getReplicas()
Number of desired pods.String
getResourceType()
The name of a resource type as it appears in the relevant API endpoint.StatefulSetUpdateStrategy
getStrategy()
The update startegy of this stateful set.-
Methods inherited from class org.cdk8s.plus24.Workload
getConnections, getMatchExpressions, getMatchLabels, getPodMetadata, getScheduling, select
-
Methods inherited from class org.cdk8s.plus24.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.plus24.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:
getApiObject
in 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:
getResourceType
in interfaceIApiResource
- Specified by:
getResourceType
in 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.
-
-