# KubernetesAspireDashboardResource.WithServicePort

- Module: [Aspire.Hosting.Kubernetes](/reference/api/go/aspire.hosting.kubernetes.md)
- Defined on: [KubernetesAspireDashboardResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesaspiredashboardresource.md)
- Version: `13.6.5-preview.1.26559.7`
- Kind: `method`

Sets the Kubernetes Service port for the Aspire Dashboard HTTP endpoint.

## Remarks

This sets the `port` field on the generated Kubernetes Service while keeping the
`targetPort` as the original container port. This is useful when placing the dashboard
behind an ingress controller that expects a specific Service port (for example, port 80).
To access the dashboard from outside the cluster, use `kubectl port-forward` or
configure the environment's `DefaultServiceType`
to `NodePort` or `LoadBalancer`.

## Definition

```go
type KubernetesAspireDashboardResource interface {
    // ... omitted for brevity
    WithServicePort(options ...*WithServicePortOptions) KubernetesAspireDashboardResource
}
```

## Signature

```go
WithServicePort(options ...*WithServicePortOptions) KubernetesAspireDashboardResource
```

## Parameters

- `options` (`...*WithServicePortOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithServicePortOptions` argument.

- `Port` (`*float64`) -- The Service port number. Cluster-internal clients will connect to this port, which routes to the dashboard's container port (18888). If `null`, the Service port defaults to the container port.

## Returns

[`KubernetesAspireDashboardResource`](/reference/api/go/aspire.hosting.kubernetes/kubernetesaspiredashboardresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [KubernetesAspireDashboardResource](/reference/api/go/aspire.hosting.kubernetes/kubernetesaspiredashboardresource.md) -- `handle`
