# HorizontalPodAutoscaler

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

Represents the Kubernetes HorizontalPodAutoscaler resource for managing the dynamic scaling of pods based on custom or predefined metrics.

## Definition

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

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

## Remarks

The HorizontalPodAutoscaler resource is part of the Kubernetes autoscaling/v1 API version. It automatically adjusts the number of replicas in a replication controller, deployment, or replica set based on observed metrics such as CPU utilization. This class encapsulates the configuration settings, including the scaling target reference and metric thresholds, required to define a HorizontalPodAutoscaler in a Kubernetes cluster.

## Constructors

- [HorizontalPodAutoscaler](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscaler/constructors.md#constructor) -- Represents the Kubernetes HorizontalPodAutoscaler resource for managing the dynamic scaling of pods based on custom or predefined metrics.

## Properties

- [Spec](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscaler/properties.md#spec) : [HorizontalPodAutoscalerSpecV1](/reference/api/csharp/aspire.hosting.kubernetes/horizontalpodautoscalerspecv1.md) `get; set` -- Gets or sets the specification that defines the desired behavior of the Horizontal Pod Autoscaler.
