Skip to content
forked from mkimuram/k8sviz

Generate Kubernetes architecture diagrams from the actual state in a namespace

License

Notifications You must be signed in to change notification settings

massif-dev/k8sviz

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

k8sviz

k8sviz is a tool to generate Kubernetes architecture diagrams from the actual state in a namespace. Currently, this only generates a diagram similar to https://github.com/kubernetes/community/tree/master/icons#usage-example by using graphviz. For examples of the generated diagrams, see Examples below.

Implementations

There are two implementations, bash script version and go version. Bash script version is just a wrapper to run go version inside container.

Prerequisites

Bash script version

k8sviz.sh depends on docker.

Go version

k8sviz only depends dot (graphviz) command.

Installation

Bash script version

Just download k8sviz.sh file and add execution permission.

$ curl -LO https://raw.githubusercontent.com/mkimuram/k8sviz/master/k8sviz.sh
$ chmod u+x k8sviz.sh

Go version

$ git clone https://github.com/mkimuram/k8sviz.git
$ cd k8sviz
$ export GO111MODULE=on
$ go build -o k8sviz .

k8sviz binary can be moved to another directory, but icons directory needs to be in the same directory to the binary.

Usage

Bash script version

$ ./k8sviz.sh --help
Generate Kubernetes architecture diagrams from the actual state in a namespace
Usage:
  k8sviz.sh [options]
Options:
  -h, --help                 Displays the help text
  -n, --namespace            The namespace to visualize. Default is default
  -o, --outfile              The filename to output. Default is k8sviz.out
  -t, --type                 The type of output. Default is dot
  -k, --kubeconfig           Path to kubeconfig file. Default is ~/kubeconfig
  -i, --image                Image name of the container. Default is mkimuram/k8sviz:0.2

Go version

$ ./k8sviz -h
Usage of ./k8sviz:
  -kubeconfig string
        absolute path to the kubeconfig file (default "/root/.kube/config")
  -n string
        namespace to visualize (shorthand) (default "namespace")
  -namespace string
        namespace to visualize (default "namespace")
  -o string
        output filename (shorthand) (default "k8sviz.out")
  -outfile string
        output filename (default "k8sviz.out")
  -t string
        type of output (shorthand) (default "dot")
  -type string
        type of output (default "dot")

Examples

Examples are only shown for bash script version, but go version should work in the same way. Report bugs or critical differences, if you find any.

Examples for tutorial deployments in default namespace

  • Generate dot file for namespace default
$ ./k8sviz.sh -n default -o default.dot
  • Generate png file for namespace default
$ ./k8sviz.sh -n default -t png -o default.png

Examples for more complex deployment (kubeflow case)

  • Generate dot file for namespace kubeflow and istio-system
$ ./k8sviz.sh -n kubeflow -o examples/kubeflow/kubeflow.dot
$ ./k8sviz.sh -n istio-system -o examples/kubeflow/istio-system.dot
  • Generate png file for namespace kubeflow and istio-system
$ ./k8sviz.sh -n kubeflow -t png -o examples/kubeflow/kubeflow.png
$ ./k8sviz.sh -n istio-system -t png -o examples/kubeflow/istio-system.png

License

This project is licensed under the Apache License - see the LICENSE file for details

About

Generate Kubernetes architecture diagrams from the actual state in a namespace

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 84.4%
  • Shell 11.0%
  • Makefile 3.5%
  • Dockerfile 1.1%