NPV - NetworkPolicyViewer
This project fetches NetworkPolicy resources from the Kubernetes cluster
identified by the current KUBECONFIG
environment variable and prints a
PlantUML component diagram to stdout.
Install
go install github.com/mrxk/npv@latest
Usage
npv - Network Policy Visualizer
Usage:
npv visualize [(--namespace=<namespace>...|--file=<file>...)] [--out=<out>] [(--ingress-only|--egress-only)]
Options:
--namespace=<namespace> Namespace containing Network Policies to visualize
--file=<file> Path to file containing Network Policies to visualize
--out=<out> Path to write visualiztion (- for stdout) (default: -)
--ingress-only Visualize only ingress rules
--egress-only Visualize only egress rules
If not given --namespace
or --file
, all NetworkPolicy resources in the
cluster identified by the current KUBECONFIG
environment variable will be
fetched. Multiple --namespace
or --file
options can be provided to include
the NetworkPolicy resources from multiple namespaces or files in one graph.
Globs can be passed to --file
although care must be taken to ensure the shell
does not expand the glob before executing npv
. The output can be filtered to
only ingress or egress rules with either --ingress-only
or --egress-only
options.
The output can be saved and processed with PlantUML or piped directly to it.
npv visualize --namespace default | java -jar plantuml-1.2024.8.jar -pipe > default.png
PlantUML can be downloaded from
https://plantuml.com/download.
Build
- Clone the project
- Build with
go build
Examples