# StatefulSet

- Kind: `class`
- Package: [Aspire.Hosting.Kubernetes](/reference/api/csharp/aspire.hosting.kubernetes.md)
- Version: `13.3.0-preview.1.26254.5`
- Namespace: `Aspire.Hosting.Kubernetes.Resources`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/StatefulSetV1.cs)
- Inherits: [Workload](/reference/api/csharp/aspire.hosting.kubernetes/workload.md)

Represents a Kubernetes StatefulSet resource in the "apps/v1" API group.

## Definition

```csharp
namespace Aspire.Hosting.Kubernetes.Resources;

public sealed class StatefulSet
    : Aspire.Hosting.Kubernetes.Resources.Workload
{
    // ...
}
```

## Remarks

A StatefulSet manages the deployment and scaling of a set of Pods, while ensuring that their order and state are preserved. StatefulSets are typically used for applications that require stable network identities and persistent storage, such as databases or distributed systems. This class provides an abstraction for defining the configuration of a StatefulSet object in YAML, aligning with the Kubernetes specification.

## Constructors

- [StatefulSet](/reference/api/csharp/aspire.hosting.kubernetes/statefulset/constructors.md#constructor) -- Represents a Kubernetes StatefulSet resource in the "apps/v1" API group.

## Properties

- [PodTemplate](/reference/api/csharp/aspire.hosting.kubernetes/statefulset/properties.md#podtemplate) : [PodTemplateSpecV1](/reference/api/csharp/aspire.hosting.kubernetes/podtemplatespecv1.md) `get` -- Gets the pod template specification for the StatefulSet.
- [Spec](/reference/api/csharp/aspire.hosting.kubernetes/statefulset/properties.md#spec) : [StatefulSetSpecV1](/reference/api/csharp/aspire.hosting.kubernetes/statefulsetspecv1.md) `get; set` -- Gets or sets the specification of the Kubernetes StatefulSet resource.

## Examples

```csharp
The StatefulSet class can be used to define the desired state of a set of Pods and associated resources in a Kubernetes cluster. The resource is serialized to YAML for use with Kubernetes manifests.
```
