K3sClusterResource
Represents a k3s Kubernetes cluster running as a privileged container resource. Injects the cluster's kubeconfig into a dependent resource. - -
type K3sClusterResource interface { ExpressionValue IComputeResource Resource ResourceWithArgs ResourceWithConnectionString ResourceWithEndpoints ResourceWithEnvironment ResourceWithWaitSupport}Properties
ApiEndpoint EndpointReference getApiEndpoint() EndpointReferenceConnectionStringEnvironmentVariable *stringgetConnectionStrings__ prefix so Aspire injects KUBECONFIG.ConnectionStringEnvironmentVariable() (*string, error)ConnectionStringExpression *ReferenceExpression getConnectionStringExpression() *ReferenceExpressionMethods
AddHelmRelease( name string, chart string, options ...*AddHelmReleaseOptions,) 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.options...*AddHelmReleaseOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*AddHelmReleaseOptions argument.
Repo*stringOptional Helm repository URL, e.g. https://argoproj.github.io/argo-helm . When provided, the repo is added and updated before installation.Version*stringOptional chart version to pin, e.g. 7.8.0. When null the latest version available in the repository is installed.Namespace*stringThe Kubernetes namespace to install the release into. The namespace is created automatically if it does not exist. Defaults to default.Returns
HelmReleaseResource A builder for the Helm.
Returns a handle; failures surface later via Err().
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 A builder for the K8s.
Returns a handle; failures surface later via Err().
AddServiceEndpoint( name string, serviceName string, servicePort float64, options ...*AddServiceEndpointOptions,) 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 float64The port number declared on the Kubernetes Service (the port field, not targetPort ). Must be in the range 1–65535.options...*AddServiceEndpointOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*AddServiceEndpointOptions argument.
Namespace*stringThe Kubernetes namespace that contains the Service. Defaults to default.Scheme*stringThe 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 A builder for the K3s.
Returns a handle; failures surface later via Err().
WithAgentCount(count float64) K3sClusterResourceParameters
countfloat64The 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 The same builder, for chaining.
Returns a handle; failures surface later via Err().
WithDataVolume(options ...*WithDataVolumeOptions) K3sClusterResourceParameters
options...*WithDataVolumeOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithDataVolumeOptions argument.
Name*stringOptional volume name. When null (the default) a name is generated from the application and resource names.Returns
K3sClusterResource The same builder, for chaining.
Returns a handle; failures surface later via Err().
--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 The same builder, for chaining.
Returns a handle; failures surface later via Err().
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 The same builder, for chaining.
Returns a handle; failures surface later via Err().
helm upgrade --install for all HelmReleaseResource children of this cluster.WithHelmImage(options ...*WithHelmImageOptions) K3sClusterResourceParameters
options...*WithHelmImageOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithHelmImageOptions argument.
Tag*stringImage tag, e.g. 3.18.0. null keeps the current value.Image*stringImage name, e.g. alpine/helm . null keeps the current value.Registry*stringRegistry, e.g. docker.io . null keeps the current value.Returns
K3sClusterResource The same builder, for chaining.
Returns a handle; failures surface later via Err().
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 The same builder, for chaining.
Returns a handle; failures surface later via Err().
kubectl apply for all K8sManifestResource children of this cluster.WithKubectlImage(options ...*WithKubectlImageOptions) K3sClusterResourceParameters
options...*WithKubectlImageOptions Optional settings, described under Options.Options
Optional parameters are passed in a trailing options ...*WithKubectlImageOptions argument.
Tag*stringImage tag, e.g. 1.37.0. null keeps the current value.Image*stringImage name, e.g. alpine/kubectl . null keeps the current value.Registry*stringRegistry, e.g. docker.io . null keeps the current value.Returns
K3sClusterResource The same builder, for chaining.
Returns a handle; failures surface later via Err().
WithLifetime(lifetime ContainerLifetime) K3sClusterResourceParameters
lifetimeContainerLifetime The container lifetime to apply.Returns
K3sClusterResource The same builder, for chaining.
Returns a handle; failures surface later via Err().
--cluster-cidr ).WithPodSubnet(cidr string) K3sClusterResourceParameters
cidrstringThe pod subnet in CIDR notation, e.g. 10.42.0.0/16.Returns
K3sClusterResource The same builder, for chaining.
Returns a handle; failures surface later via Err().
--service-cidr ).WithServiceSubnet(cidr string) K3sClusterResourceParameters
cidrstringThe service subnet in CIDR notation, e.g. 10.43.0.0/16.Returns
K3sClusterResource The same builder, for chaining.
Returns a handle; failures surface later via Err().