# ContainerPortV1 Properties

- Package: [Aspire.Hosting.Kubernetes](/reference/api/csharp/aspire.hosting.kubernetes.md)
- Type: [ContainerPortV1](/reference/api/csharp/aspire.hosting.kubernetes/containerportv1.md)
- Kind: `Properties`
- Members: `5`

Represents the configuration for a container port in Kubernetes.

## ContainerPort

- Name: `ContainerPort`
- Modifiers: `nullable` `get; set`
- Returns: [Int32OrStringV1?](/reference/api/csharp/aspire.hosting.kubernetes/int32orstringv1.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/ContainerPortV1.cs)

Gets or sets the port number on the container where the application is running.

```csharp
public Int32OrStringV1? ContainerPort { get; set; }
```

## Remarks

This property specifies the port inside the container to which the external traffic or internal service communication is directed. It is required to define this property for the proper routing of network traffic within a containerized application.

## HostIp

- Name: `HostIp`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/ContainerPortV1.cs)

Represents the host IP address to which the port is bound.

```csharp
public string HostIp { get; set; }
```

## HostPort

- Name: `HostPort`
- Modifiers: `nullable` `get; set`
- Returns: [Int32OrStringV1?](/reference/api/csharp/aspire.hosting.kubernetes/int32orstringv1.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/ContainerPortV1.cs)

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.

```csharp
public Int32OrStringV1? HostPort { get; set; }
```

## Name

- Name: `Name`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/ContainerPortV1.cs)

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.

```csharp
public string Name { get; set; }
```

## Protocol

- Name: `Protocol`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Kubernetes/Resources/ContainerPortV1.cs)

Gets or sets the protocol used by the port. Common protocols include "TCP" and "UDP".

```csharp
public string Protocol { get; set; }
```
