1 of 63

Pre-read

The slides in this deck are publicly available!

These are the slides that correspond to Kris Nóva’s 2023 FOSDEM talk.

All comments on the slides will be publicly visible.

For private feedback please email: nova@nivenly.org.

The Go gopher was designed by Renee French licensed under Creative Commons.

I have written permission to use the Untitled Goose Game art form House House and Panic.

Ferris the Crab was designed by Dzuk and licensed under Creative Commons.

The Kubernetes logo is Apache 2.0 licensed.

2 of 63

3 of 63

4 of 63

Aurae

Distributed Systems Runtime

5 of 63

Kris Nóva

hachyderm.io/@nova

Principal Engineer

Author

Computer Science

6 of 63

Overview and Context

github.com/aurae-runtime/aurae

7 of 63

What is Aurae?

An open source Rust project aimed at simplifying node management at scale.

A generic “execution engine” for containers, VMs, and processes

8 of 63

Thesis Statement

Bringing deliberate runtime controls to a node will unlock a new generation of higher order distributed systems.

Simplifying the execution stack will foster secure and observable systems while reducing complexity and risk.

9 of 63

What is a “node”?

hachyderm.io/@nova

..not Node JS

A single compute unit in a set.

EG: A server in a cluster.

10 of 63

What does Aurae do?

Control of every runtime process on a node.

Runs as a minimal init system with a remote API.

Manages processes, containers, virtual machines.

Runs on Linux.

11 of 63

What doesn’t it do?

Generic desktop support is out of scope.

Higher order scheduling is out of scope.

Does not run on Darwin.

Does not run on Windows.

12 of 63

Where did it come from?

Challenges with complexity at scale.

Desire to simplify and secure the stack.

Hope for a stronger node API.

Hope for managing nodes at scale.

13 of 63

All workloads are untrusted

The reality of scale.

14 of 63

Boring

Functional

Guiding Principles

Attainable

Single Binary

Polymorphic, easy to ship, lightweight, strong scope, low risk

Strong Interfaces

Wanted to build a “standard library” for multiple purposes.

Plays nice with others

Kubernetes Container Runtime Interface

(all of them…)

15 of 63

We want boring systems!

Most problems stem from complexity, drift, and disparate systems

Attack Surface?

Node upgrades?

Pod boundary?

Which YAML?

Container Escapes?

Network interfaces?

Label selector templates?

Template render?

What about systemd?

Docker?

Security context?

Federation?

Service Mesh?

Istio?

DNS?

kube-proxy?

Iptables? nftables?

Resource quota?

Kernel versions?

Observability?

The Kubelet has an API?

16 of 63

Safe

Guiding Principles

Tenant Security

How do we make it easy to do the right thing?

How do we bake security into systems that are already online?

17 of 63

Aurae

We wrote a paper

18 of 63

Started in Go

“Aurae Legacy”

NAML

Daemon Proof of Concept

Created familiar interfaces.

Needed to re-create the JSON/YAML dance.

What about access to libc?

Turing Complete Manifests

“Not Another Markup Language”

Kubernetes objects in Go.

Basically the Go SDK.

github.com/aurae-runtime/aurae-legacy

github.com/krisnova/naml

19 of 63

libc

virtualization

..but

eBPF

hachyderm.io/@nova

Pid 1

Cgroups V2

Clone3, Ptrace

init semantics, udev

Existing Libs

C Libraries

KVM

Firecracker

Cgroup controllers

Probes

We want to instrument our isolation zones.

What about writing the probe bytecode?

20 of 63

Go 1.20 Update

Unwrap()

Clone()

Errors

Go 1.20

Memory

Go is starting to take memory safety seriously

21 of 63

Rust

I made the decision to move to Rust.

22 of 63

Rust

to help us solve the YAML problem

23 of 63

All Config Drifts Towards Turing Completion

hachyderm.io/@nova

24 of 63

AuraeScript

Rust binary that embeds connection logic for auraed

25 of 63

Deno and TypeScript

github.com/denoland/deno

In order to keep the system attainable I wanted a simple and safe Turing complete language in favor of static config.

Deno is a simple runtime for TypeScript written in Rust.

26 of 63

AuraeScript as a Client

hachyderm.io/@nova

AuraeScript embeds Deno and a Rust client.

TypeScript as a replacement for YAML

27 of 63

sleep.ts

28 of 63

sleep.ts

YAML but with math

29 of 63

Patterns Emerged

hachyderm.io/@nova

start

stop

status

nginx.ts

dashboard.ts

Static Service Definitions

Turing Complete Generic Functionality

30 of 63

Rust

to help us solve the sidecar problem with auraed

31 of 63

A sidecar that is always available with the same features as the host.

hachyderm.io/@nova

Rust memory safety is key.

32 of 63

Any sufficiently mature infrastructure service will evolve into a sidecar.

hachyderm.io/@nova

33 of 63

Features for Both:

The host and your workload

Logging

Tokio streams

Authn / Authz

#derive[]

Derive access controls at the feature level in Rust

Identity

RustTLS

Substantially simpler

Network

Direct access to Linux network devices

eBPF facilities

34 of 63

Rust unlocks “Spawn”

Rust gives us access to virtualization, containers, processes, and the kernel

Single API for both nodes and inter-workload features

What we bring to the host, we bring to your workload

All memory safe

35 of 63

Assemble nested images from host filesystem at runtime��No downloading images

No pause containers

Spawn

Aurae Host Daemon

Privileged

/proc/self/exe

Cell Sandbox

Nested Aurae Daemon

Pod Sandbox

Nested Aurae Daemon

VM Sandbox

Nested Aurae Daemon

36 of 63

Rust

to help solve the untrusted workload problem

37 of 63

Reduced attack surface

Borrow checker pays off here

Memory Safety

Init Container

Hi Ian! I love you!

Isolation Zone

(Pod Sandbox, VM, Cells)

Nested Aurae Daemon

pid=1

Untrusted Workload

pid=2

Untrusted Workload

pid=3

38 of 63

Managing Memory for mTLS in Auraed

39 of 63

Rust

to help us solve the maintainability problem

40 of 63

Did somebody say macros?

@future_highway

Third party resources? Custom Resource Definitions? YAML? Controllers? But what does it mean?

41 of 63

API Machinery, Third Party Resources, CRDs

Go/Kubernetes Want Macros

Starting with generic objects

//go:generate

zz_kube_types.go

42 of 63

What are Rust macros?

Rust lets you write code that can write other code.

cells_call.rs

pods_call.rs

vms_call.rs

aurae_macros.rs

ae_macro.rs

aer_macro.rs

43 of 63

What are Rust macros?

Rust lets you write code that can write other code.

cells_call.rs

pods_call.rs

vms_call.rs

aurae_macros.rs

ae_macro.rs

aer_macro.rs

ae_cells.rs

44 of 63

What are Rust macros?

Rust lets you write code that can write other code.

These are unique needs of Aurae!

45 of 63

Macros in Aurae

hachyderm.io/@nova

Rust Client

AuraeScript

Documentation

Deno Ops

TypeScript library

Rust Source Code

46 of 63

Macros as an Investment

Manual Plumbing

Improve

Refine

Rust Macro

Binary

47 of 63

Macros as an Investment

Rust Macro

Binary

48 of 63

The State of the Art

  • auraed is the main static binary written in Rust and compiled with musl
  • aer is completely generated from .proto with Rust macros
  • auraescript is completely generated from .proto with Rust macros
  • ae is an alternative command line client written in Go

49 of 63

Rust

to help us solve the boring problem

50 of 63

Takeaways

  • Completely stateless
  • Nodes are declarative
    • can just be TypeScript or JSON
  • Easy to manage nodes like containers

51 of 63

What’s Next?

  • Harden deployment
    • Support for service config
    • Support for supply chain authentication
  • Kernel virtualization
    • OCI support for micro VMs
  • Minimal distribution of lightweight Linux + Auraed

52 of 63

Getting Involved

GitHub

github.com/aurae-runtime/aurae

Docs

aurae.io

Twitch

twitch.tv/krisnova

Discord

discord.gg/T76jkkMbSj

53 of 63

Twitch Crew

@future_highway

@dma42

@orz

@taniwha3

@kuxaku

@malte_aero

@zunderscore

@lastchain

@quintessence

@esk

@hazelweakly

@rrethy

54 of 63

Demo

hachyderm.io/@nova

55 of 63

56 of 63

Interesting Takeaways

hachyderm.io/@nova

A gopher’s first year of Rust

57 of 63

Is it..?

A microkernel?

A unikernel?

A system system?

It depends.

58 of 63

Rust Development Flow

Idea

Establish feature to add to code base

Implement

Design and fight with the borrow checker

Setup

Basic plumbing, Cargo.toml, build.rs, etc

Profit

It’s kind of just done now

0m

+30m

+10m

+31m

59 of 63

There is only the “right” way

..there isn’t really any other way.

60 of 63

Rust is easy to hate

…if you try to fight the language instead of letting the language show you the way.

- @togglebit

61 of 63

Go vs Rust

Frequently Asked Question

62 of 63

Rust

Go

My Opinion

auraed

Safe, Reliable

Ship “right”

Fight the compiler

Libc is a super power

ae

Fast, Practical

Ship “right now”

Fight the debugger

Libc is a risk

I feel lucky to know both and have access to both.

63 of 63

Node Config

Management

hachyderm.io/@nova

…is the wrong conversation to be having.

Why are we trying to

“get better”

at hacking user level configuration for systems with no users?