kube-rs: Building Kubernetes Controllers in Rust

Shriira Press

Preface

Build Kubernetes controllers, operators, and cluster-native applications in Rust with a client and runtime designed for the job.

Welcome to kube-rs: Building Kubernetes Controllers in Rust.

kube-rs is the Rust client ecosystem for Kubernetes — a CNCF sandbox project that gives Rust programs an idiomatic, type-aware way to talk to a cluster and to build the controllers and operators that keep it running. At its centre is the kube crate, a facade over a layered client in the spirit of client-go, a runtime inspired by controller-runtime, and a derive macro for custom resources inspired by kubebuilder. This book walks the whole stack. We begin with what kube-rs is and the problem it solves, then work through the Api client and how typed and dynamic objects coexist, the layered crate architecture, the watcher and reflector that turn the watch API into reliable local state, the Controller and its reconcile loop, the CustomResource derive macro that turns a Rust struct into a CRD, and the practical concerns — finalizers, events, server-side apply, observability — that separate a demo from a production operator. A closing chapter assembles these pieces into a working operator and surveys where kube-rs sits in the cloud-native world.

This title is part of the ShriIra library and is free to read in full, right here — our small contribution to making world-class knowledge easy to reach.

A note on reading it: open the Contents menu at the top of the reader to jump between chapters, use the Aa menu to set a comfortable text size, theme (light, sepia, or night), and single- or two-page layout. Your place is saved automatically, so you can always pick up where you left off.

We hope it serves you well.

— Shriira Press

Contents

  1. Chapter 1 — Why Kubernetes in Rust
  2. Chapter 2 — The Api Client
  3. Chapter 3 — Architecture of the Crates
  4. Chapter 4 — Watchers, Reflectors, and Stores
  5. Chapter 5 — The Controller and the Reconcile Loop
  6. Chapter 6 — Custom Resources with kube-derive
  7. Chapter 7 — Operators in Production
  8. Chapter 8 — kube-rs in Practice
0%
1/1