Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

controller-rs

> 云原生
Open source

A kubernetes reference controller with actix-web

339 stars0 likes0 views
WebsiteGitHub

About

A kubernetes reference controller with actix-web

controller-rs

A rust kubernetes reference controller for a Document resource using kube, with observability instrumentation.

The Controller object reconciles Document instances when changes to it are detected, writes to its .status object, creates associated events, and uses finalizers for guaranteed delete handling.

Installation

CRD

Apply the CRD from cached file, or pipe it from crdgen to pickup schema changes:

bash
cargo run --bin crdgen | kubectl apply -f -

Controller

Install the controller via helm by setting your preferred settings. For defaults:

bash
helm template charts/doc-controller | kubectl apply -f -
kubectl wait --for=condition=available deploy/doc-controller --timeout=30s
kubectl port-forward service/doc-controller 8080:80

The helm chart sets up the container built from this repository.

Opentelemetry

Build and run with telemetry feature, or configure it via helm:

bash
helm template charts/doc-controller --set tracing.enabled=true | kubectl apply -f -

This requires an opentelemetry collector in your cluster. Tempo / opentelemetry-operator / grafana agent should all work out of the box. If your collector does not support grpc otlp you need to change the exporter in telemetry.rs.

Note that the images are pushed either with or without the telemetry feature depending on whether the tag includes otel.

Metrics

Metrics is available on /metrics and a ServiceMonitor is configurable from the chart:

bash
helm template charts/doc-controller --set serviceMonitor.enabled=true | kubectl apply -f -

Running

Locally

bash
cargo run

or, with optional telemetry:

bash
OPENTELEMETRY_ENDPOINT_URL=https://0.0.0.0:4317 RUST_LOG=info,kube=trace,controller=debug cargo run --features=telemetry

In-cluster

For prebuilt, edit the chart values or snapshotted yaml and apply as you see fit (like above).

To develop by building/reloading the deployment in k3d quickly, you can use tilt up.

Usage

In either of the run scenarios, your app is listening on port 8080, and it will observe Document events.

Try some of:

bash
kubectl apply -f yaml/instance-lorem.yaml
kubectl delete doc lorem
kubectl edit doc lorem # change hidden

The reconciler will run and write the status object on every change. You should see results in the logs of the pod, or on the .status object outputs of kubectl get doc -oyaml.

Webapp output

The sample web server exposes some example metrics and debug information you can inspect with curl.

…

The metrics will be scraped by prometheus if you setup aServiceMonitor for it.

Runtime Log Level

You can change the log level at runtime without restarting:

bash
curl -X PUT 0.0.0.0:8080/log-level \
  -H 'Content-Type: application/json' \
  -d '{"filter": "controller=debug,kube=warn,info"}'

The filter value follows the RUST_LOG / EnvFilter directive syntax.

Events

The example reconciler only checks the .spec.hidden bool. If it does, it updates the .status object to reflect whether or not the instance is_hidden. It also sends a Kubernetes event associated with the controller. It is visible at the bottom of kubectl describe doc samuel.

To extend this controller for a real-world setting. Consider looking at the kube.rs controller guide.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustactixcontrollerexamplekubernetes

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category云原生
PricingOpen source

> Related tools

K
Kubernetes
容器编排事实标准
H
Helm
Kubernetes 包管理器
S
seaweedfs
SeaweedFS is a distributed storage system for object storage (S3), file systems, and Iceberg tables,