Creates a preview diagram of Kubernetes Resources without the need to apply them.
Project description
K8s Diagram Previewer
This project exists to help developers take some of the guesswork out of deploying Kubernetes definitions by providing a preview of what will actually be deployed with a set of YAML definitions.
Installation
Clone the repo and run pip install k8s-diagram
You may also need to install graphviz.
Running
This script takes one argument, a path to a folder containing K8s
YAML definitions and outputs a PNG diagram at kubernetes.png
representing those definitions, as well as a python file at
create_diagram.py if you would like to extend the diagram with
other infrastructure surrounding your project. To automatically
open the image upon completion, add the --show flag.
python app.py <path_to_folder>
To try out the example, run python3 diagram.py ./example_yaml
For Helm Charts, simply run with the --helm flag and your chart will be
templated and placed into /tmp/helm_preview_yaml/chart.yaml before the script runs.
You can also pass in a context from kubeconfig with the --cluster-context flag to pull in all supported resources from
the target context prior to diagram generation.
Run python diagram.py -h to see other available options.
usage: diagram.py [-h] [-s] [-f {png,jpg,pdf,svg}] [-p] [-n] [--helm] [--helm-args HELM_ARGS] Folder Path
Create preview diagram of K8s YAML
positional arguments:
Folder Path Path to the target definitions
optional arguments:
-h, --help show this help message and exit
-s, --show Show the diagram when finished
-f {png,jpg,pdf,svg}, --image-format {png,jpg,pdf,svg}
Output diagram as png, jpg, svg or pdf.
-p, --diagram-py Save a python script at create_diagram.py that can be edited to add more to the diagram.
-n, --networking-only
Only draw diagram edges to display networking, ignore storage links, etc.
--helm Indicates that the path given is a helm chart that needs to be templated.
--helm-args HELM_ARGS
String of arguments to use with helm template. Ex: "--set ingress.enabled=true"
Support
This tool currently supports the following Kubernetes resource types:
- Deployment
- Service
- Ingress
- Pod
- CronJob
- Job
- DaemonSet
- StatefulSet
- ConfigMap
- Secret
- PersistentVolumeClaim
There is partial support for all node types listed at https://diagrams.mingrammer.com/docs/nodes/k8s but links will not be formed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file k8s-diagram-0.1.1.tar.gz.
File metadata
- Download URL: k8s-diagram-0.1.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.5 Darwin/21.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45c91b696a6f871d871f7c26a0ea0842571337c51f2e11d1017e418e53b6cd0f
|
|
| MD5 |
2e654f2dbfc6550e6e4b5548475922a8
|
|
| BLAKE2b-256 |
00ed5f4fe9ac2f08e64e9fc0cee2e83c76b25fda6e6c25458f5f5bbe35afaf5f
|
File details
Details for the file k8s_diagram-0.1.1-py3-none-any.whl.
File metadata
- Download URL: k8s_diagram-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.5 Darwin/21.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8668c511c8d168aa23e8418e5cc7d43afc4c2912c4ade1eba95524b3171fa871
|
|
| MD5 |
d4fddf4dd41cb5fc0342cb7b40c93ba0
|
|
| BLAKE2b-256 |
958d085bf9c385c7b8ebb03ace4ff3d480c78b547ade31192256300187535fd2
|