Skip to content
tchellomelloPublic

About

Test NetworkPolicy changes against real cluster traffic before they merge, using Cilium's own policy engine.

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

80 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GuardBee

GuardBee

Ship the policy. Not the outage.
See which real flows a Cilium network policy would break before it merges.

CI Latest release License: Apache 2.0

Try the Lab · Watch the demo · Docs · Website

GuardBee's Verdict view: a candidate policy that allows webapp but would silently drop Prometheus's scrape and kubelet's health probe, shown as red dashed edges


A CiliumNetworkPolicy can pass review, pass CI and still take down production. It might lock a database down to "just the app" and forget the metrics exporter, or forget the kubelet health probe (reserved:host), or DNS. Every one of those is valid YAML. Usually the first sign is a page.

GuardBee replays your cluster's real recent traffic through Cilium's own policy engine twice: once with today's policies, once with your candidate added. Then it tells you what changes.

$ guardbee verdict -n postgres --last 50 looks-correct.yaml

NEWLY_DROPPED  observability/prometheus-xxxxx -> postgres/postgres-xxxxx
  TCP:9187  (currently allowed; this candidate would start blocking it)

NEWLY_DROPPED  reserved:host -> postgres/postgres-xxxxx
  TCP:5432  (currently allowed; this candidate would start blocking it)

50 flows sampled: 15 unchanged, 17 newly dropped, 0 newly allowed, ...

17 real flow(s) would BREAK if this candidate merged as-is —
review the NEWLY_DROPPED rows above before shipping it.

The candidate was never applied. GuardBee reads it as a file.

Why you can trust the verdict

  • It runs Cilium's code, not a reimplementation. GuardBee embeds Cilium's own pkg/policy engine, pinned to an exact Cilium release. The release tag names it, e.g. v1.20.4-6.
  • It judges real traffic. The flows come straight from Hubble, from your own cluster. Nothing is synthetic.
  • It stays out of your cluster. It's a single local binary that uses your kubeconfig. There's no in-cluster agent and no flow database, and it's read-only by default.
  • It tells you what it can't judge. Anything it can't simulate faithfully is named, never guessed. For example, live policies using fromNodes/toNodes are skipped with a warning (Hubble flows carry no node labels), and a Kubernetes NetworkPolicy in a candidate file is listed under "Not judged" (only CNP and CCNP are judged). Known limits →

Get started

1. Install: grab a release binary (Linux and macOS, amd64 and arm64), or use Nix:

nix run github:tchellomello/guardbee -- version

2. No cluster handy? The Lab brings up a local kind cluster with Cilium and reproduces the regression above, step by step:

git clone https://github.com/tchellomello/guardbee && cd guardbee
mise run lab-up

3. On your own cluster (Hubble Relay enabled, read-only RBAC in kubernetes/rbac.yaml):

guardbee verdict -n my-app my-candidate.yaml   # what would this break?
guardbee ui                                     # same engine, in the browser

What's in the box

Command What it answers
verdict Which real flows would this candidate newly drop or newly allow?
blame Which live policy (or default deny) allowed or dropped this pod's traffic?
flows What traffic is actually hitting this namespace? Filters follow hubble's flag names.
policies Which CNPs and CCNPs are live right now?
ui All of the above in a local web UI with a graph-based policy editor. It calls the exact same functions as the CLI.

verdict also handles L7 rules: it judges each DNS query and HTTP request Hubble recorded, and it handles toFQDNs candidates before they're live. guardbee ui --enable-probes adds opt-in, bounded TCP/UDP connectivity tests. That flag is the only feature that changes anything in the cluster.

Gate pull requests in CI

guardbee verdict -n my-app --fail-on-dropped --min-flows 20 --format markdown candidate.yaml

The command exits non-zero if a real flow would break, and --format markdown prints a summary you can post as a PR comment. A ready-made GitHub Actions workflow → · Exit codes and JSON output →

Documentation

Quickstart Catch a real regression on a local kind cluster in about ten minutes
Install Release binaries, Nix flake (NixOS, Home Manager), versioning
Run on your cluster Prerequisites, read-only RBAC, kubeconfig
Gate PRs in CI A copy-paste GitHub Actions workflow that comments and fails on regressions
Lab · Lab extras · Zero-trust walkthrough Hands-on: the full regression story, then connectivity tests, L7 rules, toFQDNs, and least privilege from default deny
Commands Every subcommand and flag
How it works · FAQ The engine, its known limits, how it differs from hubble, dry-run and audit mode
Build from source mise or plain Go

Contributing

Issues and PRs are welcome. Before you make a non-trivial change to the engine (verdict.go), read AGENTS.md for the architecture principles, the known Cilium-internals gotchas and the house style.

License

Apache License 2.0

About

Test NetworkPolicy changes against real cluster traffic before they merge, using Cilium's own policy engine.

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages