# WithOtlpServicePort

- Module: [Aspire.Hosting.Kubernetes](/reference/api/go/aspire.hosting.kubernetes.md)
- Version: `13.6.5-preview.1.26559.7`
- Kind: `method`
- Defined on: [`KubernetesAspireDashboardResource`](/reference/api/go/aspire.hosting.kubernetes/kubernetesaspiredashboardresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/b33d222049f1ecc3bc7257ec07b622fe550b2580)

Sets the Kubernetes Service ports for the Aspire Dashboard OTLP endpoints.

## Remarks

This sets the `port` field on the generated Kubernetes Service for the OTLP endpoints
while keeping the `targetPort` as the original container port. Application resources
in the cluster send telemetry to these Service ports. Use standard OTLP ports (4317 for gRPC,
4318 for HTTP) if your services are configured with those defaults.

## Definition

```go
func (KubernetesAspireDashboardResource) WithOtlpServicePort(options ...*WithOtlpServicePortOptions) KubernetesAspireDashboardResource
```

## Parameters

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

## Options

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

- `GrpcPort` (`*float64`) -- The Service port for the OTLP gRPC endpoint. If `null`, the Service port defaults to the container port (18889).
- `HttpPort` (`*float64`) -- The Service port for the OTLP HTTP endpoint. If `null`, the Service port defaults to the container port (18890).

## Returns

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

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

## Applies to

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