Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building Kubernetes Operators in Rust: A New Op...

Building Kubernetes Operators in Rust: A New Operator SDK Plugin

Kubernetes Community Days Istanbul, May 2025

Avatar for Aykut Bulgu

Aykut Bulgu

May 24, 2025
Tweet

More Decks by Aykut Bulgu

Other Decks in Programming

Transcript

  1. X: @systemcraftsman | 🦋: @systemcraftsman.com Building Kubernetes Operators in Rust:

    A New Operator SDK Plugin Aykut M. Bulgu Principal Software Engineer @ Red Hat @SystemCraftsman
  2. X: @systemcraftsman | 🦋: @systemcraftsman.com About Me #oc apply -f

    aykutbulgu.yaml apiVersion: redhat/v7 kind: Principal Software Engineer metadata: name: Aykut Bulgu namespace: Red Hat Ansible Engineering (previously Kafka) annotations: twitter: @SystemCraftsman bsky: @SystemCraftsman.com email: - [email protected] - [email protected] ex-organizer: Software Craftsmanship Turkey founder: System Craftsman labels: married: yes children: 2 interests: - basketball/nba/rockets - gamification - stoicism spec: replicas: 1 containers: - image: aykut:latest
  3. X: @systemcraftsman | 🦋: @systemcraftsman.com Schedule • Operators • Developing

    Operators ◦ Kubebuilder ◦ Operator SDK • Why Not Rust? • Why Rust? • Developing Operators with Rust ◦ Kube-rs ◦ Rust Operator SDK Plugin • Demo
  4. X: @systemcraftsman | 🦋: @systemcraftsman.com The Control Loop In robotics

    and automation, a control loop is a non-terminating loop that regulates the state of a system. In Kubernetes, controllers are control loops that watch the state of your cluster, then make or request changes where needed.
  5. X: @systemcraftsman | 🦋: @systemcraftsman.com Ways of Developing Operators •

    Calling the API directly => 🥷🥷🥷 • Using the Clients => 🥷🥷 • Using Operator Development Frameworks => 🥷
  6. X: @systemcraftsman | 🦋: @systemcraftsman.com Operator Development Frameworks • Kubebuilder

    • Operator SDK • Metacontroller • Charmed Operator SDK • KubeOps
  7. X: @systemcraftsman | 🦋: @systemcraftsman.com Kubebuilder $ kubebuilder init …

    Kubebuilder is a framework for building Kubernetes APIs using custom resource definitions (CRDs).
  8. X: @systemcraftsman | 🦋: @systemcraftsman.com Operator SDK • Ansible •

    Helm • Go • Java (Quarkus) Java Operator SDK (with Quarkus Extension)
  9. X: @systemcraftsman | 🦋: @systemcraftsman.com Operator SDK $ operator-sdk init

    … … --plugins helm … --plugins ansible … --plugins quarkus
  10. X: @systemcraftsman | 🦋: @systemcraftsman.com Rust is Fast! • Zero-cost

    abstractions: Rust compiles high-level constructs down to efficient machine code without runtime overhead. • No garbage collector: Unlike Go, Rust has no GC pauses. This is critical in latency-sensitive workloads like operators or controllers managing many custom resources. • Predictable performance: No hidden allocations, background threads, or GC behavior makes Rust predictable in both throughput and latency.
  11. X: @systemcraftsman | 🦋: @systemcraftsman.com Rust is Safe • Ownership

    model: Eliminates entire classes of bugs like use-after-free, null pointer dereferencing, and data races at compile time. • Concurrency safety: Thread safety is enforced by the type system, making it harder to write racy code even in multithreaded operators. • Immutable-by-default: Encourages safe patterns by default, reducing unexpected side effects during reconciliations or retries.
  12. X: @systemcraftsman | 🦋: @systemcraftsman.com Rust is Sane • Strong

    static typing + pattern matching: Leads to clearer, more expressive logic in state machines like reconcile loops. • Excellent tooling: cargo, clippy, rust-analyzer, and fmt provide a top-tier developer experience out of the box. • Compiler as a mentor: The Rust compiler guides developers toward better code. The errors are verbose but educational.
  13. X: @systemcraftsman | 🦋: @systemcraftsman.com What’s Next? • Moving to

    Operator SDK org. • RBAC files • Release pipeline (artifacts only) • Webhooks • … Feel free to contribute!
  14. X: @systemcraftsman | 🦋: @systemcraftsman.com Thank You! Xwitter: @systemcraftsman 🦋Bluesky:

    @systemcraftsman.com Email: [email protected] Linkedin: https://www.linkedin.com/in/mabulgu/ Website: https://www.systemcraftsman.com/ GitHub: https://github.com/mabulgu