# HorizontalPodAutoscalerSpecV2

- 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/HorizontalPodAutoscalerSpecV2.cs)

Represents the specification for a Horizontal Pod Autoscaler (HPA) in version v2 of the Kubernetes Autoscaling API. Provides configuration settings for scaling behavior, target resource, metrics, and replica limits.

## Definition

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

public sealed class HorizontalPodAutoscalerSpecV2
{
    // ...
}
```

## Constructors

- [HorizontalPodAutoscalerSpecV2](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv2/constructors.md#constructor)

## Properties

- [Behavior](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv2/properties.md#behavior) : [HorizontalPodAutoscalerBehaviorV2](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerbehaviorv2.md) `get; set` -- Specifies the scaling behavior configuration for a Horizontal Pod Autoscaler.
- [MaxReplicas](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv2/properties.md#maxreplicas) : `int` `get; set` -- Specifies the maximum number of replicas that a resource, such as a set of pods, can scale up to using the Horizontal Pod Autoscaler (HPA).
- [Metrics](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv2/properties.md#metrics) : [List<MetricSpecV2>](/reference/api/csharp/aspire.hosting.kubernetes/metricspecv2.md) `get` -- Gets the list of metrics that determine the desired replica count for the target resource.
- [MinReplicas](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv2/properties.md#minreplicas) : `int?` `get; set` -- Specifies the minimum number of replicas that the Horizontal Pod Autoscaler should maintain.
- [ScaleTargetRef](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv2/properties.md#scaletargetref) : [CrossVersionObjectReferenceV2](/reference/api/csharp/aspire.hosting.kubernetes/crossversionobjectreferencev2.md) `get; set` -- Gets or sets the scale target reference for the HorizontalPodAutoscaler.
