Skip to main content

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

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.

k8s-diagram <path_to_folder>

To try out the example, run k8s-diagram ./examples/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. The resources found at the context will be copied into the target folder prior to chart generation.

Run k8s-diagram --help to see other available options.

Docker

You can alternatively run this project by running the docker image and mounting the yaml you want to use to /target. The image will be saved into the folder mounted to /target.

Ex: docker run -v "$(pwd)/k8s_yaml:/target" jimmymills/k8s-diagram /target

For Helm: docker run -v "$(pwd):/target" -v "$(pwd)/example_helm:/helm" diagram /helm --helm

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k8s-diagram-0.1.8.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

k8s_diagram-0.1.8-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file k8s-diagram-0.1.8.tar.gz.

File metadata

  • Download URL: k8s-diagram-0.1.8.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.2 Linux/5.8.0-1036-azure

File hashes

Hashes for k8s-diagram-0.1.8.tar.gz
Algorithm Hash digest
SHA256 ab3a26e7ce85c2ade65bfea70148840975e330ce6538189a82e6e42891f89a3d
MD5 1a413c97728de9c6e271fd161f38fb04
BLAKE2b-256 d7a0a6cf591f837d72bceef9edc347e6d9457cae803b9076494c211ea1baa9ee

See more details on using hashes here.

File details

Details for the file k8s_diagram-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: k8s_diagram-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.2 Linux/5.8.0-1036-azure

File hashes

Hashes for k8s_diagram-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5e70e5575185044236599db6fe2ff60907255bef2d6768761e6d48397ec24011
MD5 ae8677d791f374113b55025dbdb8d6e8
BLAKE2b-256 fb00081dacf799a3a86ce0d6c6de0d4b4e3942fc09850f18cf5d4cf2b172217c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page