k8sOperator 1.0.0-alpha0010

This is a prerelease version of k8sOperator.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package k8sOperator --version 1.0.0-alpha0010
                    
NuGet\Install-Package k8sOperator -Version 1.0.0-alpha0010
                    
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="k8sOperator" Version="1.0.0-alpha0010" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="k8sOperator" Version="1.0.0-alpha0010" />
                    
Directory.Packages.props
<PackageReference Include="k8sOperator" />
                    
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 k8sOperator --version 1.0.0-alpha0010
                    
#r "nuget: k8sOperator, 1.0.0-alpha0010"
                    
#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 k8sOperator@1.0.0-alpha0010
                    
#: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=k8sOperator&version=1.0.0-alpha0010&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=k8sOperator&version=1.0.0-alpha0010&prerelease
                    
Install as a Cake Tool

k8sOperator

A modern Kubernetes Operator framework for .NET that makes it easy to build custom controllers and operators.

Features

  • 🎯 Simple API - Fluent builder pattern for Kubernetes resources
  • 🔄 Reconciliation - Built-in controller pattern with informers and caching
  • 📦 Custom Resources - Full CRD support with type-safe definitions
  • 🗳️ Leader Election - High availability out of the box
  • 🚀 AOT Ready - Optimized for trimmed, single-file deployments
  • 🛠️ CLI Included - Built-in commands for install, create, and version
  • 📊 Source Generators - Automatic builder extensions for your resources

Installation

dotnet add package k8sOperator

Quick Start

1. Define Your Custom Resource

[KubernetesEntity(Group = "demo.k8s.io", ApiVersion = "v1", Kind = "MyApp")]
public class MyApp : CustomResource<MyAppSpec, MyAppStatus>
{
}

public class MyAppSpec
{
    public string Image { get; set; }
    public int Replicas { get; set; }
}

public class MyAppStatus
{
    public string Phase { get; set; }
}

2. Create a Reconciler

public class MyAppReconciler : Reconciler<MyApp>
{
    public override async Task<ReconcileResult> ReconcileAsync(
        ReconcileContext<MyApp> context,
        CancellationToken cancellationToken)
    {
        var app = context.Resource;

        // Your reconciliation logic
        // Create/update deployments, services, etc.

        context.Update(x => {
            x.WithStatus(x =>
            {
                x.State = "completed";
                x.CompletedAt = DateTime.UtcNow;
                x.Message = "Todo item has been completed.";
                x.ReconciliationCount++;
            });
        });
    }
}

3. Register and Run

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOperator(options =>
{
    options.Name = "my-operator";
    options.Namespace = "default";
});

var app = builder.Build();

appapp.AddReconciler<MyApp>(MyOperator.ReconcileAsync);

await app.RunOperatorAsync(args);

Building Resources

Use the fluent builder API:

var deployment = ObjectBuilder.Create<V1Deployment>()
    .WithName("my-app")
    .WithNamespace("default")
    .WithLabel("app", "my-app")
    .WithSpec(spec => spec
        .WithReplicas(3)
        .WithTemplate(template => template
            .WithSpec(podSpec => podSpec
                .WithContainer(c => c
                    .WithImage("nginx:latest")
                    .WithPort(80)))))
    .Build();

CLI Commands

# Show version
myoperator version

# Install CRDs
myoperator install

# Create resource
myoperator create myapp --name demo

# Show help
myoperator help

Configuration

Configure via appsettings.json or attributes:

{
  "Operator": {
    "Name": "my-operator",
    "Namespace": "default",
  }
}

Requirements

  • .NET 10.0 or later
  • Kubernetes 1.25+

License

MIT License


Built with ❤️ by Patrick Evers

Product Compatible and additional computed target framework versions.
.NET 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
1.0.0-alpha0022 25 7/25/2026
1.0.0-alpha0021 39 7/25/2026
1.0.0-alpha0020 85 7/1/2026
1.0.0-alpha0019 95 6/25/2026
1.0.0-alpha0018 109 6/18/2026
1.0.0-alpha0017 273 2/23/2026
1.0.0-alpha0016 73 2/23/2026
1.0.0-alpha0015 91 2/23/2026
1.0.0-alpha0014 138 2/18/2026
1.0.0-alpha0013 80 2/18/2026
1.0.0-alpha0012 72 2/18/2026
1.0.0-alpha0011 102 2/17/2026
1.0.0-alpha0010 75 2/17/2026
1.0.0-alpha0008 77 2/13/2026
1.0.0-alpha0007 131 2/12/2026
1.0.0-alpha0006 86 2/12/2026
1.0.0-alpha0005 81 2/12/2026
1.0.0-alpha0004 87 2/11/2026
1.0.0-alpha0003 91 2/10/2026
1.0.0-alpha0002 79 2/10/2026
Loading failed