Skip to content
 
 

Eventrouter

This repository contains a simple event router for the Kubernetes project. The event router serves as an active watcher of event resource in the kubernetes system, which takes those events and pushes them to a user specified sink. This is useful for a number of different purposes, but most notably long term behavioral analysis of your workloads running on your kubernetes cluster.

Goals

This project has several objectives, which include:

  • Persist events for longer period of time to allow for system debugging
  • Allows operators to forward events to other system(s) for archiving/ML/introspection/etc.
  • It should be relatively low overhead
  • Emit events to a pluggable sink

NOTE

eventrouter writes each event as a structured JSON object to stdout, ready to be collected by a node-level log forwarder (for example Fluent Bit or Fluentd) and shipped to your logging backend. stdout is currently the only built-in sink.

Non-Goals

  • This service does not provide a querable extension, that is a responsibility of the sink
  • This service does not serve as a storage layer, that is also the responsibility of the sink

Running Eventrouter

Standup:

kubectl apply -f https://raw.githubusercontent.com/kube-logging/eventrouter/master/deploy/eventrouter.yaml

Teardown:

kubectl delete -f https://raw.githubusercontent.com/kube-logging/eventrouter/master/deploy/eventrouter.yaml

The manifest deploys eventrouter into the kube-system namespace with a stdout sink. See deploy/eventrouter.yaml for the full example and tweak it to fit your cluster.

Inspecting the output

kubectl logs -f deployment/eventrouter -n kube-system

Watch events roll through the system as JSON, ready to be picked up by your log pipeline. Events are written to stdout; application logs are written to stderr (structured, JSON by default) so the two streams never mix.

Configuration

eventrouter is configured entirely through environment variables — all are optional:

Variable Default Description
EVENTROUTER_SINK stdout Sink to emit events to. Only stdout is built in.
EVENTROUTER_STDOUT_NAMESPACE (empty) If set, wraps each event under this key in the JSON output.
EVENTROUTER_RESYNC_INTERVAL 30m Informer resync interval (Go duration).
EVENTROUTER_METRICS_ADDR :8080 Address for the metrics + health HTTP server.
EVENTROUTER_ENABLE_METRICS true Enable the Prometheus /metrics endpoint.
EVENTROUTER_BOOKMARK_PATH (empty) Absolute path to persist the last seen resource version, to resume after a restart.
EVENTROUTER_KUBECONFIG / KUBECONFIG (empty) Path to a kubeconfig; defaults to in-cluster config.
EVENTROUTER_LOG_FORMAT json Log format: json or text.
EVENTROUTER_LOG_LEVEL info Log level: debug, info, warn, or error.

Observability

The HTTP server on EVENTROUTER_METRICS_ADDR exposes:

  • GET /metrics — Prometheus counters (eventrouter_{normal,warning,info,unknown}_total)
  • GET /healthz — liveness (always 200 while the process is up)
  • GET /readyz — readiness (200 only once the informer cache has synced)

Contributing

If you find this project useful, help us

  • Support the development of this project and star this repo! ⭐
  • Help new users with issues they may encounter. 💪
  • Send a pull request with your new features and bug fixes. 🚀

License

The project is licensed under the Apache 2.0 License.

About

A simple introspective kubernetes service that forwards events to a specified sink.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages