K3sClusterResource
Handle
interface K3sClusterResource extends IComputeResource, IExpressionValue, IManifestExpressionProvider, IResource, IResourceWithArgs, IResourceWithConnectionString, IResourceWithEndpoints, IResourceWithEnvironment, IResourceWithProbes, IResourceWithWaitSupport, IValueProvider, IValueWithReferences { readonly apiEndpoint: EndpointReference; readonly connectionStringEnvironmentVariable: string; readonly connectionStringExpression: ReferenceExpression; addHelmRelease( name: string, chart: string, repo?: string, version?: string, namespace?: string): HelmReleaseResource; addK8sManifest( name: string, path: string): K8sManifestResource; addServiceEndpoint( name: string, serviceName: string, servicePort: number, namespace?: string, scheme?: string): K3sServiceEndpointResource; withAgentCount(count: number): K3sClusterResource; withDataVolume(name?: string): K3sClusterResource; withDisabledComponent(component: string): K3sClusterResource; withExtraArg(arg: string): K3sClusterResource; withHelmImage( tag?: string, image?: string, registry?: string): K3sClusterResource; withK3sVersion(tag: string): K3sClusterResource; withKubectlImage( tag?: string, image?: string, registry?: string): K3sClusterResource; withLifetime(lifetime: ContainerLifetime): K3sClusterResource; withPodSubnet(cidr: string): K3sClusterResource; withServiceSubnet(cidr: string): K3sClusterResource;}16 members
Properties
property
apiEndpoint EndpointReference getGets the endpoint reference for the k3s API server (port 6443).
property
connectionStringEnvironmentVariable stringgetOverrides the default `ConnectionStrings__` prefix so Aspire injects `KUBECONFIG`.
property
connectionStringExpression ReferenceExpression getManifest expression for the local kubeconfig path.
Methods
Installs a Helm chart into the k3s cluster.
addHelmRelease( name: string, chart: string, repo?: string, version?: string, namespace?: string): HelmReleaseResourceParameters
namestringThe Aspire resource name; also used as the Helm release name passed to `helm upgrade --install`.chartstringThe chart name, e.g. `argo-cd` for a repo chart or `oci://registry/chart` for an OCI reference. Provide `repo` when using a named repo chart.repostringoptionalOptional Helm repository URL, e.g. `https://argoproj.github.io/argo-helm`. When provided, the repo is added and updated before installation.versionstringoptionalOptional chart version to pin, e.g. `7.8.0`. When `null` the latest version available in the repository is installed.namespacestringoptional= defaultThe Kubernetes namespace to install the release into. The namespace is created automatically if it does not exist. Defaults to `default`.Returns
HelmReleaseResource Applies Kubernetes YAML manifests or a Kustomize overlay to the cluster.
addK8sManifest( name: string, path: string): K8sManifestResourceParameters
namestringThe Aspire resource name for this manifest application.pathstringPath 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
K8sManifestResource Exposes a Kubernetes Service from the cluster as an Aspire endpoint resource.
addServiceEndpoint( name: string, serviceName: string, servicePort: number, namespace?: string, scheme?: string): K3sServiceEndpointResourceParameters
namestringThe Aspire resource name for this endpoint.serviceName stringThe name of the Kubernetes Service to forward, as it appears in `kubectl get svc`.servicePort numberThe port number declared on the Kubernetes Service (the `port` field, not `targetPort`). Must be in the range 1–65535.namespacestringoptional= defaultThe Kubernetes namespace that contains the Service. Defaults to `default`.schemestringoptionalThe URL scheme (`http` or `https`) for the injected environment variable. When `null` (the default), the scheme is inferred from the port: ports 443 and 8443 use `https`, all others use `http`.Returns
K3sServiceEndpointResource Sets the number of k3s agent (worker) nodes to add to the cluster.
withAgentCount(count: number): K3sClusterResourceParameters
countnumberThe number of agent nodes. Zero or greater. Defaults to `0` (single-node cluster — the server node acts as both control-plane and worker).Returns
K3sClusterResource Mounts a named Docker volume at the k3s data directory so cluster state persists across AppHost restarts.
withDataVolume(name?: string): K3sClusterResourceParameters
namestringoptionalOptional volume name. When `null` (the default) a name is generated from the application and resource names.Returns
K3sClusterResource Disables a built-in k3s component (`--disable=<component>`).
withDisabledComponent(component: string): K3sClusterResourceParameters
componentstringThe component name to disable. Common values include `traefik`, `servicelb`, `metrics-server`, `coredns`, and `local-storage`. Call this method multiple times to disable more than one component.Returns
K3sClusterResource Appends a raw argument to the `k3s server` command line.
withExtraArg(arg: string): K3sClusterResourceParameters
argstringThe raw argument to append, e.g. `--write-kubeconfig-mode=644`. Call this method multiple times to append additional arguments.Returns
K3sClusterResource Overrides the container image used to run `helm upgrade --install` for all `HelmReleaseResource` children of this cluster.
withHelmImage( tag?: string, image?: string, registry?: string): K3sClusterResourceParameters
tagstringoptionalImage tag, e.g. `3.18.0`. `null` keeps the current value.imagestringoptionalImage name, e.g. `alpine/helm`. `null` keeps the current value.registrystringoptionalRegistry, e.g. `docker.io`. `null` keeps the current value.Returns
K3sClusterResource Sets the k3s image version used by the cluster server and all its agent nodes.
withK3sVersion(tag: string): K3sClusterResourceParameters
tagstringThe k3s container image tag, e.g. `v1.32.3-k3s1`. Must follow the `v{major}.{minor}.{patch}-k3s{n}` format.Returns
K3sClusterResource Overrides the container image used to run `kubectl apply` for all `K8sManifestResource` children of this cluster.
withKubectlImage( tag?: string, image?: string, registry?: string): K3sClusterResourceParameters
tagstringoptionalImage tag, e.g. `1.37.0`. `null` keeps the current value.imagestringoptionalImage name, e.g. `alpine/kubectl`. `null` keeps the current value.registrystringoptionalRegistry, e.g. `docker.io`. `null` keeps the current value.Returns
K3sClusterResource Sets the container lifetime for the k3s cluster and all its agent nodes.
withLifetime(lifetime: ContainerLifetime): K3sClusterResourceParameters
lifetimeContainerLifetime The container lifetime to apply.Returns
K3sClusterResource Sets the CIDR range for pod IP addresses (`--cluster-cidr`).
withPodSubnet(cidr: string): K3sClusterResourceParameters
cidrstringThe pod subnet in CIDR notation, e.g. `10.42.0.0/16`.Returns
K3sClusterResource Sets the CIDR range for Service cluster IPs (`--service-cidr`).
withServiceSubnet(cidr: string): K3sClusterResourceParameters
cidrstringThe service subnet in CIDR notation, e.g. `10.43.0.0/16`.Returns
K3sClusterResource