k8s-pb is a Rust crate that provides Kubernetes struct bindings generated from protobuf definitions and OpenAPI schemas.
The project addresses the need for Rust developers to work with Kubernetes types that may not be available in k8s-openapi. It generates type-safe Rust structs by combining protobuf definitions from upstream Kubernetes repositories with OpenAPI schema information. The generation process downloads version-pinned protobufs from the Kubernetes API, apimachinery, apiextensions-apiserver, kube-aggregator, and metrics repositories, then transforms an OpenAPI schema into supplementary type information. These inputs are processed through prost code generation to produce Rust types with trait implementations derived from the combined metadata.
The README explicitly states the crate is not yet usable as a direct replacement within kube-rs and should be considered a reference location for Kubernetes structs. Developers should treat it as a source for type definitions that are absent from k8s-openapi rather than as a production-ready integration. The project is designed to be regenerated periodically as Kubernetes evolves, with the generation pipeline automatable through a single command.
The project maintains a structured, reproducible build process with four distinct steps that can be run independently or together. The codebase includes dedicated tooling for code generation, with transformations applied at multiple stages to ensure compatibility between protobuf and OpenAPI representations. The approach of pinning upstream versions and applying targeted patches suggests active maintenance of the generation pipeline to handle upstream changes.