# WithNamespace

- Module: [CommunityToolkit.Aspire.Hosting.Kind](/reference/api/go/communitytoolkit.aspire.hosting.kind.md)
- Version: `13.5.1-beta.895`
- Kind: `method`
- Defined on: [`KindDeployedResource`](/reference/api/go/communitytoolkit.aspire.hosting.kind/kinddeployedresource.md)
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/2c26a4c9649531d17fce3cbc4c5dea00d61d279c)

Sets the Kubernetes namespace for the deployment.

## Remarks

Helm chart resources pass `--create-namespace`. Manifest resources only pass
`--namespace` to `kubectl apply`; they do not create the namespace.

## Definition

```go
func (KindDeployedResource) WithNamespace(namespace string) KindDeployedResource
```

## Parameters

- `namespace` (`string`) -- The Kubernetes namespace.

## Returns

[`KindDeployedResource`](/reference/api/go/communitytoolkit.aspire.hosting.kind/kinddeployedresource.md) -- A reference to the `IResourceBuilder`.

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

## Applies to

- [`K8sManifestResource`](/reference/api/go/communitytoolkit.aspire.hosting.kind/k8smanifestresource.md)
- [`KindDeployedResource`](/reference/api/go/communitytoolkit.aspire.hosting.kind/kinddeployedresource.md)
- [`KindHelmChartResource`](/reference/api/go/communitytoolkit.aspire.hosting.kind/kindhelmchartresource.md)
