# K3sServiceEndpointResource Properties

- Package: [CommunityToolkit.Aspire.Hosting.K3s](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s.md)
- Type: [K3sServiceEndpointResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sserviceendpointresource.md)
- Kind: `Properties`
- Members: `7`

Represents a Kubernetes Service exposed from a k3s cluster as an Aspire endpoint resource.

<a id="connectionstringenvironmentvariable"></a>

## ConnectionStringEnvironmentVariable

- Name: `ConnectionStringEnvironmentVariable`
- Modifiers: `nullable` `get`
- Returns: `string?`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sServiceEndpointResource.cs#L76)

The environment variable name used to inject the service URL into dependents ( `services__{name}__url`), following the Aspire service-discovery convention.

```csharp
public string? ConnectionStringEnvironmentVariable { get; }
```

<a id="connectionstringexpression"></a>

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sServiceEndpointResource.cs#L88-L89)

Gets the manifest expression for the service URL. Resolves to `http(s)://localhost:{hostPort}` when the endpoint is ready.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

<a id="hostport"></a>

## HostPort

- Name: `HostPort`
- Modifiers: `get`
- Returns: `int`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sServiceEndpointResource.cs)

Gets the host port bound by the port-forward listener.

```csharp
public int HostPort { get; }
```

## Remarks

Zero until the resource transitions to `Running`. Use `WaitFor(endpoint)` to ensure this is populated before reading it from a dependent resource.

<a id="namespace"></a>

## Namespace

- Name: `Namespace`
- Modifiers: `get`
- Returns: `string`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sServiceEndpointResource.cs#L41)

Gets the Kubernetes namespace that contains the Service.

```csharp
public string Namespace { get; }
```

<a id="parent"></a>

## Parent

- Name: `Parent`
- Modifiers: `get`
- Returns: [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md)
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sServiceEndpointResource.cs#L32)

Gets the parent resource of type [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md).

```csharp
public K3sClusterResource Parent { get; }
```

<a id="servicename"></a>

## ServiceName

- Name: `ServiceName`
- Modifiers: `get`
- Returns: `string`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sServiceEndpointResource.cs#L35)

Gets the name of the Kubernetes Service being forwarded.

```csharp
public string ServiceName { get; }
```

<a id="serviceport"></a>

## ServicePort

- Name: `ServicePort`
- Modifiers: `get`
- Returns: `int`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sServiceEndpointResource.cs#L38)

Gets the port number declared on the Kubernetes Service.

```csharp
public int ServicePort { get; }
```
