THIS IS a PoC
kraph
is an experimental Go
module which allows to build a graph of API objects. The resulting graph can be represented as gonum.Graph which allows for advanced graph analysis!
You can query the resulting graph
nodes and edges based on various attributes. Equally, you can also retrieve a subgraph of a chosen node and perform further analysis on it.
At the moment only kubernetes API object graph is implemented, but the module defines pluggable interfaces which should allow for expanding the support for arbitrary API objects, such as AWS etc.
The project provides a simple Makefile which makes basic tasks, such as running tests and building the module simple:
Get dependencies:
make dep
Run tests:
make test
Build module:
make build
The project provides a simple command line utility which allows to build and query API object graphs.
At the moment only build
command is implemented with a kubernetes
subcommand which allows to build and query the kubernetes API object graph.
The project Makefile
provides kctl
task which makes building the cli utility a breeze:
Build:
make kctl
kctl
command line options:
$ ./kctl help
NAME:
kctl - build and query API object graphs
USAGE:
kctl [global options] command [command options] [arguments...]
COMMANDS:
build build a graph
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help (default: false)
kctl
currently only supports building the graph of the the Kubernetes API objects and storing them in in-memory store. It allows to dump the graph in DOT GraphViz format. This can be piped into the GraphViz tool for further processing. kctl
is in the pre-alpha state (if it can be called that at all!) and it's more of a debugging help tool at the moment as the focus of the project is the graph mapping.
NOTE: You must have kubeconfig
properly configured.
$ ./kctl build k8s -format "dot" | dot -Tsvg > cluster.svg && open cluster.svg
NOTE: dot
format is the only available and default format so you can get the same results as above by running the command below, too:
$ ./kctl build k8s | dot -Tsvg > cluster.svg && open cluster.svg