百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

controller-rs

> 云原生
开源

带有 Actix-web 的 Kubernetes 参考控制器

339 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

带有 Actix-web 的 Kubernetes 参考控制器

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustactixcontrollerexamplekubernetes

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类云原生
定价开源

> 相关工具

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