Skip to content

Example kubernetes reflector and web server with axum

License

Notifications You must be signed in to change notification settings

kube-rs/version-rs

version-rs

ci docker image

An example kube deployment reflector, watcher stream, and axum web server in <100 lines of rust. It exposes a simple version api for deployments on /versions.

Usage

Clone the repo and either run locally or deploy into a cluster:

Locally

Run against your current Kubernetes context:

cargo run

In-Cluster

Apply deployment.yaml, then kubectl port-forward service/version 8000:80

Api

Once running, the app will monitor the namespace of your context, and give you simplified version info on its web interface:

$ curl 0.0.0.0:8000/versions
[{"container":"clux/controller","name":"foo-controller","version":"latest"},{"container":"alpine","name":"debugger","version":"3.13"}]

$ curl 0.0.0.0:8000/versions/default/foo-controller
{"container":"clux/controller","name":"foo-controller","version":"latest"}

Developing

  • Locally against a cluster: cargo run
  • In-cluster: edit and tilt up *
  • Docker build: just build

NB: images + docker dev is linux/amd64 only atm.