# K3sManifestBuilderExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.K3s](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s.md)
- Type: [K3sManifestBuilderExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3smanifestbuilderextensions.md)
- Kind: `Methods`
- Members: `1`

Extension methods for applying Kubernetes YAML manifests to a k3s cluster.

<a id="addk8smanifest"></a>
<a id="addk8smanifest-iresourcebuilder-k3sclusterresource-string-string"></a>

## AddK8sManifest(IResourceBuilder<K3sClusterResource>, string, string)

- Name: `AddK8sManifest(IResourceBuilder<K3sClusterResource>, string, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<K8sManifestResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sBuilderExtensions.Manifest.cs#L54-L156)

Applies Kubernetes YAML manifests or a Kustomize overlay to the cluster.

```csharp
public static class K3sManifestBuilderExtensions
{
    public static IResourceBuilder<K8sManifestResource> AddK8sManifest(
        this IResourceBuilder<K3sClusterResource> builder,
        string name,
        string path)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<K3sClusterResource>`)
  The k3s cluster resource builder.
- `name` (`string`)
  The Aspire resource name for this manifest application.
- `path` (`string`)
  Path to a single `.yaml` / `.yml` file, a directory of YAML files, or a Kustomize overlay directory (containing `kustomization.yaml`). Relative paths are resolved against the AppHost project directory.

## Returns

`IResourceBuilder<K8sManifestResource>` -- A builder for the [K8sManifestResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k8smanifestresource.md).

## Exceptions

- `ArgumentNullException` -- `builder`, `name`, or `path` is `null`.

## Remarks

The apply mode is detected automatically from `path`:

- Single file -- applied with `kubectl apply -f`.
- Directory (no `kustomization.yaml`) -- all `.yaml` / `.yml` files in the directory are applied with `kubectl apply -f`.
- Kustomize overlay (directory contains `kustomization.yaml` or `kustomization.yml`) -- applied with `kubectl apply -k`. The directory is bind-mounted so that relative references to base manifests are preserved.

The container exits with code 0 after all manifests are applied and any CRDs have reached the `Established` condition. No host-side `kubectl` binary is required. Use `WaitForCompletion(manifest)` on resources that must start only after the manifests are applied.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
