kube-rs is a Rust client library and controller runtime for Kubernetes that provides generic abstractions over the Kubernetes API in the style of client-go, with a runtime inspired by controller-runtime and derive macros for custom resource definitions modeled after kubebuilder.
The library solves the problem of building Kubernetes applications in Rust by abstracting away the complexity of API interactions, resource watching, and controller patterns. It builds on Kubernetes apimachinery and API concepts to enable reflectors, controllers, and custom resource interfaces. The Api type provides generic interaction with Kubernetes resources, while the runtime module handles watch operations, resource versioning, and storage bookkeeping that would otherwise require manual implementation. Custom resources are defined through proc macros that automatically generate wrapper structs from annotated spec structs, eliminating boilerplate code generation.
Developers should choose this tool if they are building Kubernetes operators, controllers, or other applications that need to interact with the Kubernetes API from Rust. It suits projects ranging from lightweight reflectors to complex controllers managing custom resources. The library requires careful version alignment between kube, k8s-openapi, and schemars to match the target Kubernetes version, which is documented in the project's upgrading guide. The derive feature can be disabled if schema generation is not needed, allowing for lighter dependencies in simpler applications.
The project maintains detailed documentation at kube.rs alongside API docs, with an examples directory demonstrating usage patterns and real-world adopters listed publicly. The upgrading guide and changelog provide clear migration paths for version transitions, with noteworthy changes highlighted in releases. The project is hosted by the CNCF as a Sandbox Project.