# HorizontalPodAutoscalerV2

- 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/HorizontalPodAutoscalerV2.cs)
- Inherits: [BaseKubernetesResource](/reference/api/csharp/aspire.hosting.kubernetes/basekubernetesresource.md)

Represents a Kubernetes resource for Horizontal Pod Autoscaling (HPA) under the autoscaling/v2 API version.

## Definition

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

public sealed class HorizontalPodAutoscalerV2
    : Aspire.Hosting.Kubernetes.Resources.BaseKubernetesResource
{
    // ...
}
```

## Remarks

The HorizontalPodAutoscalerV2 class is responsible for defining and managing the behavior of the HPA, which automatically adjusts the number of pods in a deployment, replica set, or stateful set based on metrics and thresholds. It extends BaseKubernetesResource to include additional properties specific to the HPA specification as defined in Kubernetes.

## Constructors

- [HorizontalPodAutoscalerV2](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerv2/constructors.md#constructor) -- Represents a Kubernetes resource for Horizontal Pod Autoscaling (HPA) under the autoscaling/v2 API version.

## Properties

- [Spec](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerv2/properties.md#spec) : [HorizontalPodAutoscalerSpecV2](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv2.md) `get; set` -- Gets or sets the specification of the Horizontal Pod Autoscaler (HPA) in version v2 of the Kubernetes Autoscaling API.
