# K3sAgentResource

- Kind: `class`
- Package: [CommunityToolkit.Aspire.Hosting.K3s](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s.md)
- Version: `13.4.1-beta.706`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.K3s/K3sAgentResource.cs)
- Inherits: `ContainerResource`
- Implements: `IResource`, `IResourceWithParent`, `IResourceWithParent<K3sClusterResource>`

Represents a k3s agent (worker) node belonging to a [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md).

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public sealed class K3sAgentResource
    : Aspire.Hosting.ApplicationModel.ContainerResource,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithParent,
      Aspire.Hosting.ApplicationModel.IResourceWithParent<Aspire.Hosting.ApplicationModel.K3sClusterResource>
{
    // ...
}
```

## Remarks

Agent nodes run `k3s agent` and join the server at `https://{serverName}:6443` using DCP's Docker DNS. They start in parallel with the server without a `WaitFor` dependency -- k3s's built-in retry loop handles the connection timing. The cluster's health check waits for all `1 + AgentCount` nodes to reach `Ready` state before the cluster resource transitions to `Running`. Agent nodes are created automatically by `AddK3sCluster` when `K3sClusterOptions.AgentCount` is greater than zero.

## Constructors

- [K3sAgentResource(string, K3sClusterResource)](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sagentresource/constructors.md#constructor-string-k3sclusterresource) -- Represents a k3s agent (worker) node belonging to a [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md).

## Properties

- [Parent](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sagentresource/properties.md#parent) : [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md) `get` -- Gets the parent resource of type [K3sClusterResource](/reference/api/csharp/communitytoolkit.aspire.hosting.k3s/k3sclusterresource.md).
