KubeOps.Aspire.Hosting 13.1.0

dotnet add package KubeOps.Aspire.Hosting --version 13.1.0
                    
NuGet\Install-Package KubeOps.Aspire.Hosting -Version 13.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KubeOps.Aspire.Hosting" Version="13.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KubeOps.Aspire.Hosting" Version="13.1.0" />
                    
Directory.Packages.props
<PackageReference Include="KubeOps.Aspire.Hosting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KubeOps.Aspire.Hosting --version 13.1.0
                    
#r "nuget: KubeOps.Aspire.Hosting, 13.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package KubeOps.Aspire.Hosting@13.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=KubeOps.Aspire.Hosting&version=13.1.0
                    
Install as a Cake Addin
#tool nuget:?package=KubeOps.Aspire.Hosting&version=13.1.0
                    
Install as a Cake Tool

KubeOps.Aspire.Hosting

NuGet NuGet Pre-Release

KubeOps.Aspire.Hosting is the .NET Aspire hosting integration for KubeOps operators. It lets you orchestrate a KubeOps operator project as a resource inside a .NET Aspire AppHost.

It is the AppHost-side counterpart to the KubeOps.Aspire service-defaults integration.

Usage

The repository sample uses a dedicated examples/AspireOperator project so the plain examples/Operator sample remains independent of Aspire.

In your Aspire AppHost project:

var k8s = builder.AddKubernetesEnvironment("k8s")
    .WithHelm(helm =>
    {
        helm.WithChartName("my-operator");
        helm.WithReleaseName("my-operator");
        helm.WithNamespace("operator-system");
    });

var apiService = builder.AddProject<Projects.ApiService>("apiservice");

builder.AddKubeOps<Projects.AspireOperator>("operator")
    .RunWithKubernetes(k8s)
    .PublishAsKubernetesOperator(k8s)
    .WithReference(apiService);

AddKubeOps<TProject> behaves like a KubeOps-flavoured wrapper around the built-in AddProject<TProject> and returns the standard IResourceBuilder<ProjectResource>, so every Aspire extension (WithReference, WithEnvironment, WaitFor, ...) works as usual.

To complete the loop, add AddKubeOpsServiceDefaults() from the KubeOps.Aspire package in the operator project. This enables OpenTelemetry export to the Aspire dashboard and service discovery for the references wired up above.

Run and publish behavior

AddKubeOps<TProject> does not start the operator during local Aspire runs unless you opt in with RunWithKubernetes(...). This prevents an operator from accidentally using the developer's current kube context. With the default run options, missing CRDs are created before startup and only CRDs created by that AppHost run are removed on shutdown.

var dev = builder.AddKubernetesEnvironment("dev");

builder.AddKubeOps<Projects.AspireOperator>("operator")
    .RunWithKubernetes(dev, run => run.WithPersistentCrds());

RunWithKubernetes also has a generic overload that accepts any IResourceWithConnectionString whose connection string is a kubeconfig path — for example a K3sClusterResource from the CommunityToolkit Aspire k3s integration. It injects the cluster's KUBECONFIG into the operator process, waits for the cluster, starts the operator automatically, and manages CRDs identically:

var k3s = builder.AddK3sCluster("k3s");

builder.AddKubeOps<Projects.AspireOperator>("operator")
    .RunWithKubernetes(k3s);

When the AppHost uses Aspire's Kubernetes publishing support, PublishAsKubernetesOperator(k8s) invokes kubeops generate operator and appends the generated CRDs, RBAC resources, and service account to the Aspire-generated Helm chart. The operator deployment itself remains Aspire-owned, but KubeOps' generated deployment settings are merged into that workload so the chart deploys one correctly wired operator deployment.

builder.AddKubeOps<Projects.AspireOperator>("operator")
    .PublishAsKubernetesOperator(k8s, publish =>
    {
        publish.Namespace = "operator-system";
        publish.WithServiceAccount("operator");
    });

If there is no Aspire Kubernetes environment, PublishAsKubernetesOperator(...) still participates in aspire publish by writing raw KubeOps YAML for the operator resource. This standalone path does not require Helm or a live Kubernetes cluster.

builder.AddKubeOps<Projects.AspireOperator>("operator")
    .PublishAsKubernetesOperator(publish =>
    {
        publish.Namespace = "operator-system";
        publish.WithServiceAccount("operator");
    });

Use Azure and local targets independently when the development loop and deployment target are different:

var dev = builder.AddKubernetesEnvironment("dev");
var aks = builder.AddAzureKubernetesEnvironment("aks");

builder.AddKubeOps<Projects.AspireOperator>("operator")
    .RunWithKubernetes(dev)
    .PublishAsKubernetesOperator(aks, publish => publish.WithServiceAccount("operator"));

See the .NET Aspire guide for the full picture.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.1.0 60 7/21/2026
13.1.0-prerelease.2 51 7/17/2026
13.1.0-prerelease.1 53 7/16/2026
13.0.0 54 7/14/2026
13.0.0-prerelease.6 55 7/14/2026
13.0.0-prerelease.5 53 7/12/2026
13.0.0-prerelease.4 58 7/11/2026
13.0.0-prerelease.3 55 7/11/2026
13.0.0-prerelease.2 53 7/11/2026
13.0.0-prerelease.1 58 7/11/2026
12.1.0-prerelease.1 60 7/10/2026
12.0.1-prerelease.2 61 7/9/2026
12.0.1-prerelease.1 56 7/8/2026
12.0.0 83 7/7/2026
11.6.0-prerelease.1 76 7/3/2026
11.5.1-prerelease.2 57 7/2/2026
11.5.1-prerelease.1 62 7/2/2026
11.5.0 90 6/30/2026
11.5.0-prerelease.6 54 6/28/2026
11.5.0-prerelease.5 56 6/28/2026
Loading failed

'## [13.1.0](https://github.com/dotnet/dotnet-operator-sdk/compare/v13.0.0...v13.1.0) (2026-07-21)

### Features

* **generator:** expand CRD schema metadata support ([#1201](https://github.com/dotnet/dotnet-operator-sdk/issues/1201)) ([67aa3fd](https://github.com/dotnet/dotnet-operator-sdk/commit/67aa3fd3a1b5ff827bf116d80840607e3952be23)), closes [#1200](https://github.com/dotnet/dotnet-operator-sdk/issues/1200)

### Dependencies

* **ci:** update actions/setup-dotnet action to v6 ([#1204](https://github.com/dotnet/dotnet-operator-sdk/issues/1204)) ([eddcd6a](https://github.com/dotnet/dotnet-operator-sdk/commit/eddcd6ac22dadafd392a8f9515d7f2246d62e4db))
* **ci:** update actions/setup-node action to v7 ([#1199](https://github.com/dotnet/dotnet-operator-sdk/issues/1199)) ([e0621c8](https://github.com/dotnet/dotnet-operator-sdk/commit/e0621c8572c455639c88107bdfd24db711fbdfc3))
* **core:** update opentelemetry-dotnet-contrib monorepo to 1.17.0 ([#1207](https://github.com/dotnet/dotnet-operator-sdk/issues/1207)) ([6314dac](https://github.com/dotnet/dotnet-operator-sdk/commit/6314dac27bb40039a69fe38aae0b5a02eb3c66d1))
* **test:** update dependency microsoft.net.test.sdk to 18.8.1 ([#1198](https://github.com/dotnet/dotnet-operator-sdk/issues/1198)) ([9f44d7c](https://github.com/dotnet/dotnet-operator-sdk/commit/9f44d7ca3b545b0db2fdb990374c58f0205d0eef))
* **test:** update dotnet monorepo ([#1197](https://github.com/dotnet/dotnet-operator-sdk/issues/1197)) ([8fe3808](https://github.com/dotnet/dotnet-operator-sdk/commit/8fe380833ff34e47217f2b0d2703fe36b4010d1b))
* **test:** update dotnet monorepo to 18.8.2 ([#1202](https://github.com/dotnet/dotnet-operator-sdk/issues/1202)) ([3ea3844](https://github.com/dotnet/dotnet-operator-sdk/commit/3ea384479b7e9dad6d70c7553e8d18248b22e33c))
* **test:** update opentelemetry-dotnet monorepo ([#1203](https://github.com/dotnet/dotnet-operator-sdk/issues/1203)) ([68e3044](https://github.com/dotnet/dotnet-operator-sdk/commit/68e3044f032b5e5ec35abcb38acba78ff9339de8))
* **tools:** update dependency nuget-license to v4.0.15 ([#1206](https://github.com/dotnet/dotnet-operator-sdk/issues/1206)) ([711b8a7](https://github.com/dotnet/dotnet-operator-sdk/commit/711b8a7d30d7a76b1443accb2ae7bf1f0c461953))
'