Skip to content
Example of writing a Rust Kubernetes controller (operator) in less than 100 lines
Branch: master
Clone or download
Latest commit acb5886 Aug 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs initial commit Aug 7, 2019
src ran cargo fmt Aug 7, 2019
.gitignore initial commit Aug 7, 2019
Cargo.lock initial commit Aug 7, 2019
Cargo.toml initial commit Aug 7, 2019
LICENSE.txt initial commit Aug 7, 2019 updated README Aug 7, 2019

Rust Kubernetes Controller

This is an example of how easy it is to write Kubernetes controllers (operators) for Custom Resource Definitions (CRDs) in Rust. No more special generation programs, verbose configurations, and massive boilerplate... just quick and easy Kubernetes controllers.

This repository has a CRD, a CRD instance, and a simple informer-style controller. You can build and run the code by fetching this repo and then running cargo run.

The entire code is in src/


  • Make sure you have the latest Rust installed
  • Make sure you have kubectl installed and configured to point to a cluster
  • Download this code
  • Run kubectl create -f docs/crd.yaml
  • Run cargo run and keep it running
  • Wait a moment for it to start
  • Run kubectl create -f docs/book.yaml
  • Observe the output in the cargo run

To stop cargo run, use CTRL-C.

This will run the controller locally, rather than in-cluster.

You can’t perform that action at this time.