# ContainerPortV1

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

Represents the configuration for a container port in Kubernetes.

## Definition

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

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

## Remarks

A container port specifies the port mappings and settings used by containers to expose services to the host machine or other containers. This includes the container's port, optional host port, IP bindings, protocol, and an optional name for the port.

## Constructors

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

## Properties

- [ContainerPort](/reference/api/csharp/aspire.hosting.kubernetes/containerportv1/properties.md#containerport) : [Int32OrStringV1?](/reference/api/csharp/aspire.hosting.kubernetes/int32orstringv1.md) `get; set` -- Gets or sets the port number on the container where the application is running.
- [HostIp](/reference/api/csharp/aspire.hosting.kubernetes/containerportv1/properties.md#hostip) : `string` `get; set` -- Represents the host IP address to which the port is bound.
- [HostPort](/reference/api/csharp/aspire.hosting.kubernetes/containerportv1/properties.md#hostport) : [Int32OrStringV1?](/reference/api/csharp/aspire.hosting.kubernetes/int32orstringv1.md) `get; set` -- Gets or sets the port number on the host machine that is mapped to the container's port. This enables external access to the container's service.
- [Name](/reference/api/csharp/aspire.hosting.kubernetes/containerportv1/properties.md#name) : `string` `get; set` -- Gets or sets the name of the container port. This property serves as an identifier for the port and can be used for mapping or referencing purposes in the Kubernetes configuration.
- [Protocol](/reference/api/csharp/aspire.hosting.kubernetes/containerportv1/properties.md#protocol) : `string` `get; set` -- Gets or sets the protocol used by the port. Common protocols include "TCP" and "UDP".
