K8sOperator.NET is a powerful and intuitive library designed for creating Kubernetes Operators using C#. It simplifies the development of robust, cloud-native operators by leveraging the full capabilities of the .NET ecosystem, making it easier than ever to manage complex Kubernetes workloads with custom automation.
- Easy integration
To install the package, use the following command in your .NET Core project:
dotnet add package K8sOperator.NET
dotnet add package K8sOperator.NET.Generators
Alternatively, you can add it manually to your .csproj
file:
<PackageReference Include="K8sOperator.NET" Version="0.1.0" />
<PackageReference Include="K8sOperator.NET.Generators" Version="0.1.0" />
Here are some basic examples of how to use the library:
using K8sOperator.NET;
var builder = OperatorHost.CreateOperatorApplicationBuilder(args);
builder.AddController<ProjectController>()
.WithFinalizer("project.local.finalizer");
var app = builder.Build();
app.AddInstall();
await app.RunAsync();
{
"profiles": {
"Operator": {
"commandName": "Project",
"commandLineArgs": "operator",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Install": {
"commandName": "Project",
"commandLineArgs": "install > ./install.yaml",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Help": {
"commandName": "Project",
"commandLineArgs": "",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Version": {
"commandName": "Project",
"commandLineArgs": "version",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json"
}
By running the Install
profile will create the install.yaml file in the root of the project. This file can be used to install the operator in a Kubernetes cluster.
Run the following command to install the operator:
kubectl apply -f install.yaml
Contributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any bugs or have feature requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.